YES(O(1),O(n^2)) We are left with following problem, upon which TcT provides the certificate YES(O(1),O(n^2)). Strict Trs: { #abs(#0()) -> #0() , #abs(#neg(@x)) -> #pos(@x) , #abs(#pos(@x)) -> #pos(@x) , #abs(#s(@x)) -> #pos(#s(@x)) , #equal(@x, @y) -> #eq(@x, @y) , #greater(@x, @y) -> #ckgt(#compare(@x, @y)) , +(@x, @y) -> #add(@x, @y) , firstline(@l) -> firstline#1(@l) , firstline#1(::(@x, @xs)) -> ::(#abs(#0()), firstline(@xs)) , firstline#1(nil()) -> nil() , lcs(@l1, @l2) -> lcs#1(lcstable(@l1, @l2)) , lcstable(@l1, @l2) -> lcstable#1(@l1, @l2) , lcs#1(@m) -> lcs#2(@m) , lcs#2(::(@l1, @_@2)) -> lcs#3(@l1) , lcs#2(nil()) -> #abs(#0()) , lcs#3(::(@len, @_@1)) -> @len , lcs#3(nil()) -> #abs(#0()) , lcstable#1(::(@x, @xs), @l2) -> lcstable#2(lcstable(@xs, @l2), @l2, @x) , lcstable#1(nil(), @l2) -> ::(firstline(@l2), nil()) , lcstable#2(@m, @l2, @x) -> lcstable#3(@m, @l2, @x) , lcstable#3(::(@l, @ls), @l2, @x) -> ::(newline(@x, @l, @l2), ::(@l, @ls)) , lcstable#3(nil(), @l2, @x) -> nil() , newline(@y, @lastline, @l) -> newline#1(@l, @lastline, @y) , max(@a, @b) -> max#1(#greater(@a, @b), @a, @b) , max#1(#false(), @a, @b) -> @b , max#1(#true(), @a, @b) -> @a , newline#1(::(@x, @xs), @lastline, @y) -> newline#2(@lastline, @x, @xs, @y) , newline#1(nil(), @lastline, @y) -> nil() , newline#2(::(@belowVal, @lastline'), @x, @xs, @y) -> newline#3(newline(@y, @lastline', @xs), @belowVal, @lastline', @x, @y) , newline#2(nil(), @x, @xs, @y) -> nil() , newline#3(@nl, @belowVal, @lastline', @x, @y) -> newline#4(right(@nl), @belowVal, @lastline', @nl, @x, @y) , right(@l) -> right#1(@l) , newline#4(@rightVal, @belowVal, @lastline', @nl, @x, @y) -> newline#5(right(@lastline'), @belowVal, @nl, @rightVal, @x, @y) , newline#5(@diagVal, @belowVal, @nl, @rightVal, @x, @y) -> newline#6(newline#7(#equal(@x, @y), @belowVal, @diagVal, @rightVal), @nl) , newline#7(#false(), @belowVal, @diagVal, @rightVal) -> max(@belowVal, @rightVal) , newline#7(#true(), @belowVal, @diagVal, @rightVal) -> +(@diagVal, #pos(#s(#0()))) , newline#6(@elem, @nl) -> ::(@elem, @nl) , right#1(::(@x, @xs)) -> @x , right#1(nil()) -> #abs(#0()) } Weak Trs: { #eq(#0(), #0()) -> #true() , #eq(#0(), #neg(@y)) -> #false() , #eq(#0(), #pos(@y)) -> #false() , #eq(#0(), #s(@y)) -> #false() , #eq(#neg(@x), #0()) -> #false() , #eq(#neg(@x), #neg(@y)) -> #eq(@x, @y) , #eq(#neg(@x), #pos(@y)) -> #false() , #eq(#pos(@x), #0()) -> #false() , #eq(#pos(@x), #neg(@y)) -> #false() , #eq(#pos(@x), #pos(@y)) -> #eq(@x, @y) , #eq(#s(@x), #0()) -> #false() , #eq(#s(@x), #s(@y)) -> #eq(@x, @y) , #eq(::(@x_1, @x_2), ::(@y_1, @y_2)) -> #and(#eq(@x_1, @y_1), #eq(@x_2, @y_2)) , #eq(::(@x_1, @x_2), nil()) -> #false() , #eq(nil(), ::(@y_1, @y_2)) -> #false() , #eq(nil(), nil()) -> #true() , #compare(#0(), #0()) -> #EQ() , #compare(#0(), #neg(@y)) -> #GT() , #compare(#0(), #pos(@y)) -> #LT() , #compare(#0(), #s(@y)) -> #LT() , #compare(#neg(@x), #0()) -> #LT() , #compare(#neg(@x), #neg(@y)) -> #compare(@y, @x) , #compare(#neg(@x), #pos(@y)) -> #LT() , #compare(#pos(@x), #0()) -> #GT() , #compare(#pos(@x), #neg(@y)) -> #GT() , #compare(#pos(@x), #pos(@y)) -> #compare(@x, @y) , #compare(#s(@x), #0()) -> #GT() , #compare(#s(@x), #s(@y)) -> #compare(@x, @y) , #ckgt(#EQ()) -> #false() , #ckgt(#GT()) -> #true() , #ckgt(#LT()) -> #false() , #add(#0(), @y) -> @y , #add(#neg(#s(#0())), @y) -> #pred(@y) , #add(#neg(#s(#s(@x))), @y) -> #pred(#add(#pos(#s(@x)), @y)) , #add(#pos(#s(#0())), @y) -> #succ(@y) , #add(#pos(#s(#s(@x))), @y) -> #succ(#add(#pos(#s(@x)), @y)) , #pred(#0()) -> #neg(#s(#0())) , #pred(#neg(#s(@x))) -> #neg(#s(#s(@x))) , #pred(#pos(#s(#0()))) -> #0() , #pred(#pos(#s(#s(@x)))) -> #pos(#s(@x)) , #succ(#0()) -> #pos(#s(#0())) , #succ(#neg(#s(#0()))) -> #0() , #succ(#neg(#s(#s(@x)))) -> #neg(#s(@x)) , #succ(#pos(#s(@x))) -> #pos(#s(#s(@x))) , #and(#false(), #false()) -> #false() , #and(#false(), #true()) -> #false() , #and(#true(), #false()) -> #false() , #and(#true(), #true()) -> #true() } Obligation: innermost runtime complexity Answer: YES(O(1),O(n^2)) We add following dependency tuples: Strict DPs: { #abs^#(#0()) -> c_1() , #abs^#(#neg(@x)) -> c_2() , #abs^#(#pos(@x)) -> c_3() , #abs^#(#s(@x)) -> c_4() , #equal^#(@x, @y) -> c_5(#eq^#(@x, @y)) , #greater^#(@x, @y) -> c_6(#ckgt^#(#compare(@x, @y)), #compare^#(@x, @y)) , +^#(@x, @y) -> c_7(#add^#(@x, @y)) , firstline^#(@l) -> c_8(firstline#1^#(@l)) , firstline#1^#(::(@x, @xs)) -> c_9(#abs^#(#0()), firstline^#(@xs)) , firstline#1^#(nil()) -> c_10() , lcs^#(@l1, @l2) -> c_11(lcs#1^#(lcstable(@l1, @l2)), lcstable^#(@l1, @l2)) , lcs#1^#(@m) -> c_13(lcs#2^#(@m)) , lcstable^#(@l1, @l2) -> c_12(lcstable#1^#(@l1, @l2)) , lcstable#1^#(::(@x, @xs), @l2) -> c_18(lcstable#2^#(lcstable(@xs, @l2), @l2, @x), lcstable^#(@xs, @l2)) , lcstable#1^#(nil(), @l2) -> c_19(firstline^#(@l2)) , lcs#2^#(::(@l1, @_@2)) -> c_14(lcs#3^#(@l1)) , lcs#2^#(nil()) -> c_15(#abs^#(#0())) , lcs#3^#(::(@len, @_@1)) -> c_16() , lcs#3^#(nil()) -> c_17(#abs^#(#0())) , lcstable#2^#(@m, @l2, @x) -> c_20(lcstable#3^#(@m, @l2, @x)) , lcstable#3^#(::(@l, @ls), @l2, @x) -> c_21(newline^#(@x, @l, @l2)) , lcstable#3^#(nil(), @l2, @x) -> c_22() , newline^#(@y, @lastline, @l) -> c_23(newline#1^#(@l, @lastline, @y)) , newline#1^#(::(@x, @xs), @lastline, @y) -> c_27(newline#2^#(@lastline, @x, @xs, @y)) , newline#1^#(nil(), @lastline, @y) -> c_28() , max^#(@a, @b) -> c_24(max#1^#(#greater(@a, @b), @a, @b), #greater^#(@a, @b)) , max#1^#(#false(), @a, @b) -> c_25() , max#1^#(#true(), @a, @b) -> c_26() , newline#2^#(::(@belowVal, @lastline'), @x, @xs, @y) -> c_29(newline#3^#(newline(@y, @lastline', @xs), @belowVal, @lastline', @x, @y), newline^#(@y, @lastline', @xs)) , newline#2^#(nil(), @x, @xs, @y) -> c_30() , newline#3^#(@nl, @belowVal, @lastline', @x, @y) -> c_31(newline#4^#(right(@nl), @belowVal, @lastline', @nl, @x, @y), right^#(@nl)) , newline#4^#(@rightVal, @belowVal, @lastline', @nl, @x, @y) -> c_33(newline#5^#(right(@lastline'), @belowVal, @nl, @rightVal, @x, @y), right^#(@lastline')) , right^#(@l) -> c_32(right#1^#(@l)) , right#1^#(::(@x, @xs)) -> c_38() , right#1^#(nil()) -> c_39(#abs^#(#0())) , newline#5^#(@diagVal, @belowVal, @nl, @rightVal, @x, @y) -> c_34(newline#6^#(newline#7(#equal(@x, @y), @belowVal, @diagVal, @rightVal), @nl), newline#7^#(#equal(@x, @y), @belowVal, @diagVal, @rightVal), #equal^#(@x, @y)) , newline#6^#(@elem, @nl) -> c_37() , newline#7^#(#false(), @belowVal, @diagVal, @rightVal) -> c_35(max^#(@belowVal, @rightVal)) , newline#7^#(#true(), @belowVal, @diagVal, @rightVal) -> c_36(+^#(@diagVal, #pos(#s(#0())))) } Weak DPs: { #eq^#(#0(), #0()) -> c_40() , #eq^#(#0(), #neg(@y)) -> c_41() , #eq^#(#0(), #pos(@y)) -> c_42() , #eq^#(#0(), #s(@y)) -> c_43() , #eq^#(#neg(@x), #0()) -> c_44() , #eq^#(#neg(@x), #neg(@y)) -> c_45(#eq^#(@x, @y)) , #eq^#(#neg(@x), #pos(@y)) -> c_46() , #eq^#(#pos(@x), #0()) -> c_47() , #eq^#(#pos(@x), #neg(@y)) -> c_48() , #eq^#(#pos(@x), #pos(@y)) -> c_49(#eq^#(@x, @y)) , #eq^#(#s(@x), #0()) -> c_50() , #eq^#(#s(@x), #s(@y)) -> c_51(#eq^#(@x, @y)) , #eq^#(::(@x_1, @x_2), ::(@y_1, @y_2)) -> c_52(#and^#(#eq(@x_1, @y_1), #eq(@x_2, @y_2)), #eq^#(@x_1, @y_1), #eq^#(@x_2, @y_2)) , #eq^#(::(@x_1, @x_2), nil()) -> c_53() , #eq^#(nil(), ::(@y_1, @y_2)) -> c_54() , #eq^#(nil(), nil()) -> c_55() , #ckgt^#(#EQ()) -> c_68() , #ckgt^#(#GT()) -> c_69() , #ckgt^#(#LT()) -> c_70() , #compare^#(#0(), #0()) -> c_56() , #compare^#(#0(), #neg(@y)) -> c_57() , #compare^#(#0(), #pos(@y)) -> c_58() , #compare^#(#0(), #s(@y)) -> c_59() , #compare^#(#neg(@x), #0()) -> c_60() , #compare^#(#neg(@x), #neg(@y)) -> c_61(#compare^#(@y, @x)) , #compare^#(#neg(@x), #pos(@y)) -> c_62() , #compare^#(#pos(@x), #0()) -> c_63() , #compare^#(#pos(@x), #neg(@y)) -> c_64() , #compare^#(#pos(@x), #pos(@y)) -> c_65(#compare^#(@x, @y)) , #compare^#(#s(@x), #0()) -> c_66() , #compare^#(#s(@x), #s(@y)) -> c_67(#compare^#(@x, @y)) , #add^#(#0(), @y) -> c_71() , #add^#(#neg(#s(#0())), @y) -> c_72(#pred^#(@y)) , #add^#(#neg(#s(#s(@x))), @y) -> c_73(#pred^#(#add(#pos(#s(@x)), @y)), #add^#(#pos(#s(@x)), @y)) , #add^#(#pos(#s(#0())), @y) -> c_74(#succ^#(@y)) , #add^#(#pos(#s(#s(@x))), @y) -> c_75(#succ^#(#add(#pos(#s(@x)), @y)), #add^#(#pos(#s(@x)), @y)) , #and^#(#false(), #false()) -> c_84() , #and^#(#false(), #true()) -> c_85() , #and^#(#true(), #false()) -> c_86() , #and^#(#true(), #true()) -> c_87() , #pred^#(#0()) -> c_76() , #pred^#(#neg(#s(@x))) -> c_77() , #pred^#(#pos(#s(#0()))) -> c_78() , #pred^#(#pos(#s(#s(@x)))) -> c_79() , #succ^#(#0()) -> c_80() , #succ^#(#neg(#s(#0()))) -> c_81() , #succ^#(#neg(#s(#s(@x)))) -> c_82() , #succ^#(#pos(#s(@x))) -> c_83() } and mark the set of starting terms. We are left with following problem, upon which TcT provides the certificate YES(O(1),O(n^2)). Strict DPs: { #abs^#(#0()) -> c_1() , #abs^#(#neg(@x)) -> c_2() , #abs^#(#pos(@x)) -> c_3() , #abs^#(#s(@x)) -> c_4() , #equal^#(@x, @y) -> c_5(#eq^#(@x, @y)) , #greater^#(@x, @y) -> c_6(#ckgt^#(#compare(@x, @y)), #compare^#(@x, @y)) , +^#(@x, @y) -> c_7(#add^#(@x, @y)) , firstline^#(@l) -> c_8(firstline#1^#(@l)) , firstline#1^#(::(@x, @xs)) -> c_9(#abs^#(#0()), firstline^#(@xs)) , firstline#1^#(nil()) -> c_10() , lcs^#(@l1, @l2) -> c_11(lcs#1^#(lcstable(@l1, @l2)), lcstable^#(@l1, @l2)) , lcs#1^#(@m) -> c_13(lcs#2^#(@m)) , lcstable^#(@l1, @l2) -> c_12(lcstable#1^#(@l1, @l2)) , lcstable#1^#(::(@x, @xs), @l2) -> c_18(lcstable#2^#(lcstable(@xs, @l2), @l2, @x), lcstable^#(@xs, @l2)) , lcstable#1^#(nil(), @l2) -> c_19(firstline^#(@l2)) , lcs#2^#(::(@l1, @_@2)) -> c_14(lcs#3^#(@l1)) , lcs#2^#(nil()) -> c_15(#abs^#(#0())) , lcs#3^#(::(@len, @_@1)) -> c_16() , lcs#3^#(nil()) -> c_17(#abs^#(#0())) , lcstable#2^#(@m, @l2, @x) -> c_20(lcstable#3^#(@m, @l2, @x)) , lcstable#3^#(::(@l, @ls), @l2, @x) -> c_21(newline^#(@x, @l, @l2)) , lcstable#3^#(nil(), @l2, @x) -> c_22() , newline^#(@y, @lastline, @l) -> c_23(newline#1^#(@l, @lastline, @y)) , newline#1^#(::(@x, @xs), @lastline, @y) -> c_27(newline#2^#(@lastline, @x, @xs, @y)) , newline#1^#(nil(), @lastline, @y) -> c_28() , max^#(@a, @b) -> c_24(max#1^#(#greater(@a, @b), @a, @b), #greater^#(@a, @b)) , max#1^#(#false(), @a, @b) -> c_25() , max#1^#(#true(), @a, @b) -> c_26() , newline#2^#(::(@belowVal, @lastline'), @x, @xs, @y) -> c_29(newline#3^#(newline(@y, @lastline', @xs), @belowVal, @lastline', @x, @y), newline^#(@y, @lastline', @xs)) , newline#2^#(nil(), @x, @xs, @y) -> c_30() , newline#3^#(@nl, @belowVal, @lastline', @x, @y) -> c_31(newline#4^#(right(@nl), @belowVal, @lastline', @nl, @x, @y), right^#(@nl)) , newline#4^#(@rightVal, @belowVal, @lastline', @nl, @x, @y) -> c_33(newline#5^#(right(@lastline'), @belowVal, @nl, @rightVal, @x, @y), right^#(@lastline')) , right^#(@l) -> c_32(right#1^#(@l)) , right#1^#(::(@x, @xs)) -> c_38() , right#1^#(nil()) -> c_39(#abs^#(#0())) , newline#5^#(@diagVal, @belowVal, @nl, @rightVal, @x, @y) -> c_34(newline#6^#(newline#7(#equal(@x, @y), @belowVal, @diagVal, @rightVal), @nl), newline#7^#(#equal(@x, @y), @belowVal, @diagVal, @rightVal), #equal^#(@x, @y)) , newline#6^#(@elem, @nl) -> c_37() , newline#7^#(#false(), @belowVal, @diagVal, @rightVal) -> c_35(max^#(@belowVal, @rightVal)) , newline#7^#(#true(), @belowVal, @diagVal, @rightVal) -> c_36(+^#(@diagVal, #pos(#s(#0())))) } Weak DPs: { #eq^#(#0(), #0()) -> c_40() , #eq^#(#0(), #neg(@y)) -> c_41() , #eq^#(#0(), #pos(@y)) -> c_42() , #eq^#(#0(), #s(@y)) -> c_43() , #eq^#(#neg(@x), #0()) -> c_44() , #eq^#(#neg(@x), #neg(@y)) -> c_45(#eq^#(@x, @y)) , #eq^#(#neg(@x), #pos(@y)) -> c_46() , #eq^#(#pos(@x), #0()) -> c_47() , #eq^#(#pos(@x), #neg(@y)) -> c_48() , #eq^#(#pos(@x), #pos(@y)) -> c_49(#eq^#(@x, @y)) , #eq^#(#s(@x), #0()) -> c_50() , #eq^#(#s(@x), #s(@y)) -> c_51(#eq^#(@x, @y)) , #eq^#(::(@x_1, @x_2), ::(@y_1, @y_2)) -> c_52(#and^#(#eq(@x_1, @y_1), #eq(@x_2, @y_2)), #eq^#(@x_1, @y_1), #eq^#(@x_2, @y_2)) , #eq^#(::(@x_1, @x_2), nil()) -> c_53() , #eq^#(nil(), ::(@y_1, @y_2)) -> c_54() , #eq^#(nil(), nil()) -> c_55() , #ckgt^#(#EQ()) -> c_68() , #ckgt^#(#GT()) -> c_69() , #ckgt^#(#LT()) -> c_70() , #compare^#(#0(), #0()) -> c_56() , #compare^#(#0(), #neg(@y)) -> c_57() , #compare^#(#0(), #pos(@y)) -> c_58() , #compare^#(#0(), #s(@y)) -> c_59() , #compare^#(#neg(@x), #0()) -> c_60() , #compare^#(#neg(@x), #neg(@y)) -> c_61(#compare^#(@y, @x)) , #compare^#(#neg(@x), #pos(@y)) -> c_62() , #compare^#(#pos(@x), #0()) -> c_63() , #compare^#(#pos(@x), #neg(@y)) -> c_64() , #compare^#(#pos(@x), #pos(@y)) -> c_65(#compare^#(@x, @y)) , #compare^#(#s(@x), #0()) -> c_66() , #compare^#(#s(@x), #s(@y)) -> c_67(#compare^#(@x, @y)) , #add^#(#0(), @y) -> c_71() , #add^#(#neg(#s(#0())), @y) -> c_72(#pred^#(@y)) , #add^#(#neg(#s(#s(@x))), @y) -> c_73(#pred^#(#add(#pos(#s(@x)), @y)), #add^#(#pos(#s(@x)), @y)) , #add^#(#pos(#s(#0())), @y) -> c_74(#succ^#(@y)) , #add^#(#pos(#s(#s(@x))), @y) -> c_75(#succ^#(#add(#pos(#s(@x)), @y)), #add^#(#pos(#s(@x)), @y)) , #and^#(#false(), #false()) -> c_84() , #and^#(#false(), #true()) -> c_85() , #and^#(#true(), #false()) -> c_86() , #and^#(#true(), #true()) -> c_87() , #pred^#(#0()) -> c_76() , #pred^#(#neg(#s(@x))) -> c_77() , #pred^#(#pos(#s(#0()))) -> c_78() , #pred^#(#pos(#s(#s(@x)))) -> c_79() , #succ^#(#0()) -> c_80() , #succ^#(#neg(#s(#0()))) -> c_81() , #succ^#(#neg(#s(#s(@x)))) -> c_82() , #succ^#(#pos(#s(@x))) -> c_83() } Weak Trs: { #abs(#0()) -> #0() , #abs(#neg(@x)) -> #pos(@x) , #abs(#pos(@x)) -> #pos(@x) , #abs(#s(@x)) -> #pos(#s(@x)) , #equal(@x, @y) -> #eq(@x, @y) , #eq(#0(), #0()) -> #true() , #eq(#0(), #neg(@y)) -> #false() , #eq(#0(), #pos(@y)) -> #false() , #eq(#0(), #s(@y)) -> #false() , #eq(#neg(@x), #0()) -> #false() , #eq(#neg(@x), #neg(@y)) -> #eq(@x, @y) , #eq(#neg(@x), #pos(@y)) -> #false() , #eq(#pos(@x), #0()) -> #false() , #eq(#pos(@x), #neg(@y)) -> #false() , #eq(#pos(@x), #pos(@y)) -> #eq(@x, @y) , #eq(#s(@x), #0()) -> #false() , #eq(#s(@x), #s(@y)) -> #eq(@x, @y) , #eq(::(@x_1, @x_2), ::(@y_1, @y_2)) -> #and(#eq(@x_1, @y_1), #eq(@x_2, @y_2)) , #eq(::(@x_1, @x_2), nil()) -> #false() , #eq(nil(), ::(@y_1, @y_2)) -> #false() , #eq(nil(), nil()) -> #true() , #greater(@x, @y) -> #ckgt(#compare(@x, @y)) , #compare(#0(), #0()) -> #EQ() , #compare(#0(), #neg(@y)) -> #GT() , #compare(#0(), #pos(@y)) -> #LT() , #compare(#0(), #s(@y)) -> #LT() , #compare(#neg(@x), #0()) -> #LT() , #compare(#neg(@x), #neg(@y)) -> #compare(@y, @x) , #compare(#neg(@x), #pos(@y)) -> #LT() , #compare(#pos(@x), #0()) -> #GT() , #compare(#pos(@x), #neg(@y)) -> #GT() , #compare(#pos(@x), #pos(@y)) -> #compare(@x, @y) , #compare(#s(@x), #0()) -> #GT() , #compare(#s(@x), #s(@y)) -> #compare(@x, @y) , #ckgt(#EQ()) -> #false() , #ckgt(#GT()) -> #true() , #ckgt(#LT()) -> #false() , +(@x, @y) -> #add(@x, @y) , #add(#0(), @y) -> @y , #add(#neg(#s(#0())), @y) -> #pred(@y) , #add(#neg(#s(#s(@x))), @y) -> #pred(#add(#pos(#s(@x)), @y)) , #add(#pos(#s(#0())), @y) -> #succ(@y) , #add(#pos(#s(#s(@x))), @y) -> #succ(#add(#pos(#s(@x)), @y)) , firstline(@l) -> firstline#1(@l) , firstline#1(::(@x, @xs)) -> ::(#abs(#0()), firstline(@xs)) , firstline#1(nil()) -> nil() , lcs(@l1, @l2) -> lcs#1(lcstable(@l1, @l2)) , lcstable(@l1, @l2) -> lcstable#1(@l1, @l2) , lcs#1(@m) -> lcs#2(@m) , lcs#2(::(@l1, @_@2)) -> lcs#3(@l1) , lcs#2(nil()) -> #abs(#0()) , lcs#3(::(@len, @_@1)) -> @len , lcs#3(nil()) -> #abs(#0()) , lcstable#1(::(@x, @xs), @l2) -> lcstable#2(lcstable(@xs, @l2), @l2, @x) , lcstable#1(nil(), @l2) -> ::(firstline(@l2), nil()) , lcstable#2(@m, @l2, @x) -> lcstable#3(@m, @l2, @x) , lcstable#3(::(@l, @ls), @l2, @x) -> ::(newline(@x, @l, @l2), ::(@l, @ls)) , lcstable#3(nil(), @l2, @x) -> nil() , newline(@y, @lastline, @l) -> newline#1(@l, @lastline, @y) , max(@a, @b) -> max#1(#greater(@a, @b), @a, @b) , max#1(#false(), @a, @b) -> @b , max#1(#true(), @a, @b) -> @a , newline#1(::(@x, @xs), @lastline, @y) -> newline#2(@lastline, @x, @xs, @y) , newline#1(nil(), @lastline, @y) -> nil() , newline#2(::(@belowVal, @lastline'), @x, @xs, @y) -> newline#3(newline(@y, @lastline', @xs), @belowVal, @lastline', @x, @y) , newline#2(nil(), @x, @xs, @y) -> nil() , newline#3(@nl, @belowVal, @lastline', @x, @y) -> newline#4(right(@nl), @belowVal, @lastline', @nl, @x, @y) , right(@l) -> right#1(@l) , newline#4(@rightVal, @belowVal, @lastline', @nl, @x, @y) -> newline#5(right(@lastline'), @belowVal, @nl, @rightVal, @x, @y) , newline#5(@diagVal, @belowVal, @nl, @rightVal, @x, @y) -> newline#6(newline#7(#equal(@x, @y), @belowVal, @diagVal, @rightVal), @nl) , newline#7(#false(), @belowVal, @diagVal, @rightVal) -> max(@belowVal, @rightVal) , newline#7(#true(), @belowVal, @diagVal, @rightVal) -> +(@diagVal, #pos(#s(#0()))) , newline#6(@elem, @nl) -> ::(@elem, @nl) , right#1(::(@x, @xs)) -> @x , right#1(nil()) -> #abs(#0()) , #pred(#0()) -> #neg(#s(#0())) , #pred(#neg(#s(@x))) -> #neg(#s(#s(@x))) , #pred(#pos(#s(#0()))) -> #0() , #pred(#pos(#s(#s(@x)))) -> #pos(#s(@x)) , #succ(#0()) -> #pos(#s(#0())) , #succ(#neg(#s(#0()))) -> #0() , #succ(#neg(#s(#s(@x)))) -> #neg(#s(@x)) , #succ(#pos(#s(@x))) -> #pos(#s(#s(@x))) , #and(#false(), #false()) -> #false() , #and(#false(), #true()) -> #false() , #and(#true(), #false()) -> #false() , #and(#true(), #true()) -> #true() } Obligation: innermost runtime complexity Answer: YES(O(1),O(n^2)) Consider the dependency graph 1: #abs^#(#0()) -> c_1() 2: #abs^#(#neg(@x)) -> c_2() 3: #abs^#(#pos(@x)) -> c_3() 4: #abs^#(#s(@x)) -> c_4() 5: #equal^#(@x, @y) -> c_5(#eq^#(@x, @y)) -->_1 #eq^#(::(@x_1, @x_2), ::(@y_1, @y_2)) -> c_52(#and^#(#eq(@x_1, @y_1), #eq(@x_2, @y_2)), #eq^#(@x_1, @y_1), #eq^#(@x_2, @y_2)) :52 -->_1 #eq^#(#s(@x), #s(@y)) -> c_51(#eq^#(@x, @y)) :51 -->_1 #eq^#(#pos(@x), #pos(@y)) -> c_49(#eq^#(@x, @y)) :49 -->_1 #eq^#(#neg(@x), #neg(@y)) -> c_45(#eq^#(@x, @y)) :45 -->_1 #eq^#(nil(), nil()) -> c_55() :55 -->_1 #eq^#(nil(), ::(@y_1, @y_2)) -> c_54() :54 -->_1 #eq^#(::(@x_1, @x_2), nil()) -> c_53() :53 -->_1 #eq^#(#s(@x), #0()) -> c_50() :50 -->_1 #eq^#(#pos(@x), #neg(@y)) -> c_48() :48 -->_1 #eq^#(#pos(@x), #0()) -> c_47() :47 -->_1 #eq^#(#neg(@x), #pos(@y)) -> c_46() :46 -->_1 #eq^#(#neg(@x), #0()) -> c_44() :44 -->_1 #eq^#(#0(), #s(@y)) -> c_43() :43 -->_1 #eq^#(#0(), #pos(@y)) -> c_42() :42 -->_1 #eq^#(#0(), #neg(@y)) -> c_41() :41 -->_1 #eq^#(#0(), #0()) -> c_40() :40 6: #greater^#(@x, @y) -> c_6(#ckgt^#(#compare(@x, @y)), #compare^#(@x, @y)) -->_2 #compare^#(#s(@x), #s(@y)) -> c_67(#compare^#(@x, @y)) :70 -->_2 #compare^#(#pos(@x), #pos(@y)) -> c_65(#compare^#(@x, @y)) :68 -->_2 #compare^#(#neg(@x), #neg(@y)) -> c_61(#compare^#(@y, @x)) :64 -->_2 #compare^#(#s(@x), #0()) -> c_66() :69 -->_2 #compare^#(#pos(@x), #neg(@y)) -> c_64() :67 -->_2 #compare^#(#pos(@x), #0()) -> c_63() :66 -->_2 #compare^#(#neg(@x), #pos(@y)) -> c_62() :65 -->_2 #compare^#(#neg(@x), #0()) -> c_60() :63 -->_2 #compare^#(#0(), #s(@y)) -> c_59() :62 -->_2 #compare^#(#0(), #pos(@y)) -> c_58() :61 -->_2 #compare^#(#0(), #neg(@y)) -> c_57() :60 -->_2 #compare^#(#0(), #0()) -> c_56() :59 -->_1 #ckgt^#(#LT()) -> c_70() :58 -->_1 #ckgt^#(#GT()) -> c_69() :57 -->_1 #ckgt^#(#EQ()) -> c_68() :56 7: +^#(@x, @y) -> c_7(#add^#(@x, @y)) -->_1 #add^#(#pos(#s(#s(@x))), @y) -> c_75(#succ^#(#add(#pos(#s(@x)), @y)), #add^#(#pos(#s(@x)), @y)) :75 -->_1 #add^#(#pos(#s(#0())), @y) -> c_74(#succ^#(@y)) :74 -->_1 #add^#(#neg(#s(#s(@x))), @y) -> c_73(#pred^#(#add(#pos(#s(@x)), @y)), #add^#(#pos(#s(@x)), @y)) :73 -->_1 #add^#(#neg(#s(#0())), @y) -> c_72(#pred^#(@y)) :72 -->_1 #add^#(#0(), @y) -> c_71() :71 8: firstline^#(@l) -> c_8(firstline#1^#(@l)) -->_1 firstline#1^#(::(@x, @xs)) -> c_9(#abs^#(#0()), firstline^#(@xs)) :9 -->_1 firstline#1^#(nil()) -> c_10() :10 9: firstline#1^#(::(@x, @xs)) -> c_9(#abs^#(#0()), firstline^#(@xs)) -->_2 firstline^#(@l) -> c_8(firstline#1^#(@l)) :8 -->_1 #abs^#(#0()) -> c_1() :1 10: firstline#1^#(nil()) -> c_10() 11: lcs^#(@l1, @l2) -> c_11(lcs#1^#(lcstable(@l1, @l2)), lcstable^#(@l1, @l2)) -->_2 lcstable^#(@l1, @l2) -> c_12(lcstable#1^#(@l1, @l2)) :13 -->_1 lcs#1^#(@m) -> c_13(lcs#2^#(@m)) :12 12: lcs#1^#(@m) -> c_13(lcs#2^#(@m)) -->_1 lcs#2^#(nil()) -> c_15(#abs^#(#0())) :17 -->_1 lcs#2^#(::(@l1, @_@2)) -> c_14(lcs#3^#(@l1)) :16 13: lcstable^#(@l1, @l2) -> c_12(lcstable#1^#(@l1, @l2)) -->_1 lcstable#1^#(nil(), @l2) -> c_19(firstline^#(@l2)) :15 -->_1 lcstable#1^#(::(@x, @xs), @l2) -> c_18(lcstable#2^#(lcstable(@xs, @l2), @l2, @x), lcstable^#(@xs, @l2)) :14 14: lcstable#1^#(::(@x, @xs), @l2) -> c_18(lcstable#2^#(lcstable(@xs, @l2), @l2, @x), lcstable^#(@xs, @l2)) -->_1 lcstable#2^#(@m, @l2, @x) -> c_20(lcstable#3^#(@m, @l2, @x)) :20 -->_2 lcstable^#(@l1, @l2) -> c_12(lcstable#1^#(@l1, @l2)) :13 15: lcstable#1^#(nil(), @l2) -> c_19(firstline^#(@l2)) -->_1 firstline^#(@l) -> c_8(firstline#1^#(@l)) :8 16: lcs#2^#(::(@l1, @_@2)) -> c_14(lcs#3^#(@l1)) -->_1 lcs#3^#(nil()) -> c_17(#abs^#(#0())) :19 -->_1 lcs#3^#(::(@len, @_@1)) -> c_16() :18 17: lcs#2^#(nil()) -> c_15(#abs^#(#0())) -->_1 #abs^#(#0()) -> c_1() :1 18: lcs#3^#(::(@len, @_@1)) -> c_16() 19: lcs#3^#(nil()) -> c_17(#abs^#(#0())) -->_1 #abs^#(#0()) -> c_1() :1 20: lcstable#2^#(@m, @l2, @x) -> c_20(lcstable#3^#(@m, @l2, @x)) -->_1 lcstable#3^#(::(@l, @ls), @l2, @x) -> c_21(newline^#(@x, @l, @l2)) :21 -->_1 lcstable#3^#(nil(), @l2, @x) -> c_22() :22 21: lcstable#3^#(::(@l, @ls), @l2, @x) -> c_21(newline^#(@x, @l, @l2)) -->_1 newline^#(@y, @lastline, @l) -> c_23(newline#1^#(@l, @lastline, @y)) :23 22: lcstable#3^#(nil(), @l2, @x) -> c_22() 23: newline^#(@y, @lastline, @l) -> c_23(newline#1^#(@l, @lastline, @y)) -->_1 newline#1^#(::(@x, @xs), @lastline, @y) -> c_27(newline#2^#(@lastline, @x, @xs, @y)) :24 -->_1 newline#1^#(nil(), @lastline, @y) -> c_28() :25 24: newline#1^#(::(@x, @xs), @lastline, @y) -> c_27(newline#2^#(@lastline, @x, @xs, @y)) -->_1 newline#2^#(::(@belowVal, @lastline'), @x, @xs, @y) -> c_29(newline#3^#(newline(@y, @lastline', @xs), @belowVal, @lastline', @x, @y), newline^#(@y, @lastline', @xs)) :29 -->_1 newline#2^#(nil(), @x, @xs, @y) -> c_30() :30 25: newline#1^#(nil(), @lastline, @y) -> c_28() 26: max^#(@a, @b) -> c_24(max#1^#(#greater(@a, @b), @a, @b), #greater^#(@a, @b)) -->_1 max#1^#(#true(), @a, @b) -> c_26() :28 -->_1 max#1^#(#false(), @a, @b) -> c_25() :27 -->_2 #greater^#(@x, @y) -> c_6(#ckgt^#(#compare(@x, @y)), #compare^#(@x, @y)) :6 27: max#1^#(#false(), @a, @b) -> c_25() 28: max#1^#(#true(), @a, @b) -> c_26() 29: newline#2^#(::(@belowVal, @lastline'), @x, @xs, @y) -> c_29(newline#3^#(newline(@y, @lastline', @xs), @belowVal, @lastline', @x, @y), newline^#(@y, @lastline', @xs)) -->_1 newline#3^#(@nl, @belowVal, @lastline', @x, @y) -> c_31(newline#4^#(right(@nl), @belowVal, @lastline', @nl, @x, @y), right^#(@nl)) :31 -->_2 newline^#(@y, @lastline, @l) -> c_23(newline#1^#(@l, @lastline, @y)) :23 30: newline#2^#(nil(), @x, @xs, @y) -> c_30() 31: newline#3^#(@nl, @belowVal, @lastline', @x, @y) -> c_31(newline#4^#(right(@nl), @belowVal, @lastline', @nl, @x, @y), right^#(@nl)) -->_2 right^#(@l) -> c_32(right#1^#(@l)) :33 -->_1 newline#4^#(@rightVal, @belowVal, @lastline', @nl, @x, @y) -> c_33(newline#5^#(right(@lastline'), @belowVal, @nl, @rightVal, @x, @y), right^#(@lastline')) :32 32: newline#4^#(@rightVal, @belowVal, @lastline', @nl, @x, @y) -> c_33(newline#5^#(right(@lastline'), @belowVal, @nl, @rightVal, @x, @y), right^#(@lastline')) -->_1 newline#5^#(@diagVal, @belowVal, @nl, @rightVal, @x, @y) -> c_34(newline#6^#(newline#7(#equal(@x, @y), @belowVal, @diagVal, @rightVal), @nl), newline#7^#(#equal(@x, @y), @belowVal, @diagVal, @rightVal), #equal^#(@x, @y)) :36 -->_2 right^#(@l) -> c_32(right#1^#(@l)) :33 33: right^#(@l) -> c_32(right#1^#(@l)) -->_1 right#1^#(nil()) -> c_39(#abs^#(#0())) :35 -->_1 right#1^#(::(@x, @xs)) -> c_38() :34 34: right#1^#(::(@x, @xs)) -> c_38() 35: right#1^#(nil()) -> c_39(#abs^#(#0())) -->_1 #abs^#(#0()) -> c_1() :1 36: newline#5^#(@diagVal, @belowVal, @nl, @rightVal, @x, @y) -> c_34(newline#6^#(newline#7(#equal(@x, @y), @belowVal, @diagVal, @rightVal), @nl), newline#7^#(#equal(@x, @y), @belowVal, @diagVal, @rightVal), #equal^#(@x, @y)) -->_2 newline#7^#(#true(), @belowVal, @diagVal, @rightVal) -> c_36(+^#(@diagVal, #pos(#s(#0())))) :39 -->_2 newline#7^#(#false(), @belowVal, @diagVal, @rightVal) -> c_35(max^#(@belowVal, @rightVal)) :38 -->_1 newline#6^#(@elem, @nl) -> c_37() :37 -->_3 #equal^#(@x, @y) -> c_5(#eq^#(@x, @y)) :5 37: newline#6^#(@elem, @nl) -> c_37() 38: newline#7^#(#false(), @belowVal, @diagVal, @rightVal) -> c_35(max^#(@belowVal, @rightVal)) -->_1 max^#(@a, @b) -> c_24(max#1^#(#greater(@a, @b), @a, @b), #greater^#(@a, @b)) :26 39: newline#7^#(#true(), @belowVal, @diagVal, @rightVal) -> c_36(+^#(@diagVal, #pos(#s(#0())))) -->_1 +^#(@x, @y) -> c_7(#add^#(@x, @y)) :7 40: #eq^#(#0(), #0()) -> c_40() 41: #eq^#(#0(), #neg(@y)) -> c_41() 42: #eq^#(#0(), #pos(@y)) -> c_42() 43: #eq^#(#0(), #s(@y)) -> c_43() 44: #eq^#(#neg(@x), #0()) -> c_44() 45: #eq^#(#neg(@x), #neg(@y)) -> c_45(#eq^#(@x, @y)) -->_1 #eq^#(::(@x_1, @x_2), ::(@y_1, @y_2)) -> c_52(#and^#(#eq(@x_1, @y_1), #eq(@x_2, @y_2)), #eq^#(@x_1, @y_1), #eq^#(@x_2, @y_2)) :52 -->_1 #eq^#(#s(@x), #s(@y)) -> c_51(#eq^#(@x, @y)) :51 -->_1 #eq^#(#pos(@x), #pos(@y)) -> c_49(#eq^#(@x, @y)) :49 -->_1 #eq^#(nil(), nil()) -> c_55() :55 -->_1 #eq^#(nil(), ::(@y_1, @y_2)) -> c_54() :54 -->_1 #eq^#(::(@x_1, @x_2), nil()) -> c_53() :53 -->_1 #eq^#(#s(@x), #0()) -> c_50() :50 -->_1 #eq^#(#pos(@x), #neg(@y)) -> c_48() :48 -->_1 #eq^#(#pos(@x), #0()) -> c_47() :47 -->_1 #eq^#(#neg(@x), #pos(@y)) -> c_46() :46 -->_1 #eq^#(#neg(@x), #neg(@y)) -> c_45(#eq^#(@x, @y)) :45 -->_1 #eq^#(#neg(@x), #0()) -> c_44() :44 -->_1 #eq^#(#0(), #s(@y)) -> c_43() :43 -->_1 #eq^#(#0(), #pos(@y)) -> c_42() :42 -->_1 #eq^#(#0(), #neg(@y)) -> c_41() :41 -->_1 #eq^#(#0(), #0()) -> c_40() :40 46: #eq^#(#neg(@x), #pos(@y)) -> c_46() 47: #eq^#(#pos(@x), #0()) -> c_47() 48: #eq^#(#pos(@x), #neg(@y)) -> c_48() 49: #eq^#(#pos(@x), #pos(@y)) -> c_49(#eq^#(@x, @y)) -->_1 #eq^#(::(@x_1, @x_2), ::(@y_1, @y_2)) -> c_52(#and^#(#eq(@x_1, @y_1), #eq(@x_2, @y_2)), #eq^#(@x_1, @y_1), #eq^#(@x_2, @y_2)) :52 -->_1 #eq^#(#s(@x), #s(@y)) -> c_51(#eq^#(@x, @y)) :51 -->_1 #eq^#(nil(), nil()) -> c_55() :55 -->_1 #eq^#(nil(), ::(@y_1, @y_2)) -> c_54() :54 -->_1 #eq^#(::(@x_1, @x_2), nil()) -> c_53() :53 -->_1 #eq^#(#s(@x), #0()) -> c_50() :50 -->_1 #eq^#(#pos(@x), #pos(@y)) -> c_49(#eq^#(@x, @y)) :49 -->_1 #eq^#(#pos(@x), #neg(@y)) -> c_48() :48 -->_1 #eq^#(#pos(@x), #0()) -> c_47() :47 -->_1 #eq^#(#neg(@x), #pos(@y)) -> c_46() :46 -->_1 #eq^#(#neg(@x), #neg(@y)) -> c_45(#eq^#(@x, @y)) :45 -->_1 #eq^#(#neg(@x), #0()) -> c_44() :44 -->_1 #eq^#(#0(), #s(@y)) -> c_43() :43 -->_1 #eq^#(#0(), #pos(@y)) -> c_42() :42 -->_1 #eq^#(#0(), #neg(@y)) -> c_41() :41 -->_1 #eq^#(#0(), #0()) -> c_40() :40 50: #eq^#(#s(@x), #0()) -> c_50() 51: #eq^#(#s(@x), #s(@y)) -> c_51(#eq^#(@x, @y)) -->_1 #eq^#(::(@x_1, @x_2), ::(@y_1, @y_2)) -> c_52(#and^#(#eq(@x_1, @y_1), #eq(@x_2, @y_2)), #eq^#(@x_1, @y_1), #eq^#(@x_2, @y_2)) :52 -->_1 #eq^#(nil(), nil()) -> c_55() :55 -->_1 #eq^#(nil(), ::(@y_1, @y_2)) -> c_54() :54 -->_1 #eq^#(::(@x_1, @x_2), nil()) -> c_53() :53 -->_1 #eq^#(#s(@x), #s(@y)) -> c_51(#eq^#(@x, @y)) :51 -->_1 #eq^#(#s(@x), #0()) -> c_50() :50 -->_1 #eq^#(#pos(@x), #pos(@y)) -> c_49(#eq^#(@x, @y)) :49 -->_1 #eq^#(#pos(@x), #neg(@y)) -> c_48() :48 -->_1 #eq^#(#pos(@x), #0()) -> c_47() :47 -->_1 #eq^#(#neg(@x), #pos(@y)) -> c_46() :46 -->_1 #eq^#(#neg(@x), #neg(@y)) -> c_45(#eq^#(@x, @y)) :45 -->_1 #eq^#(#neg(@x), #0()) -> c_44() :44 -->_1 #eq^#(#0(), #s(@y)) -> c_43() :43 -->_1 #eq^#(#0(), #pos(@y)) -> c_42() :42 -->_1 #eq^#(#0(), #neg(@y)) -> c_41() :41 -->_1 #eq^#(#0(), #0()) -> c_40() :40 52: #eq^#(::(@x_1, @x_2), ::(@y_1, @y_2)) -> c_52(#and^#(#eq(@x_1, @y_1), #eq(@x_2, @y_2)), #eq^#(@x_1, @y_1), #eq^#(@x_2, @y_2)) -->_1 #and^#(#true(), #true()) -> c_87() :79 -->_1 #and^#(#true(), #false()) -> c_86() :78 -->_1 #and^#(#false(), #true()) -> c_85() :77 -->_1 #and^#(#false(), #false()) -> c_84() :76 -->_3 #eq^#(nil(), nil()) -> c_55() :55 -->_2 #eq^#(nil(), nil()) -> c_55() :55 -->_3 #eq^#(nil(), ::(@y_1, @y_2)) -> c_54() :54 -->_2 #eq^#(nil(), ::(@y_1, @y_2)) -> c_54() :54 -->_3 #eq^#(::(@x_1, @x_2), nil()) -> c_53() :53 -->_2 #eq^#(::(@x_1, @x_2), nil()) -> c_53() :53 -->_3 #eq^#(::(@x_1, @x_2), ::(@y_1, @y_2)) -> c_52(#and^#(#eq(@x_1, @y_1), #eq(@x_2, @y_2)), #eq^#(@x_1, @y_1), #eq^#(@x_2, @y_2)) :52 -->_2 #eq^#(::(@x_1, @x_2), ::(@y_1, @y_2)) -> c_52(#and^#(#eq(@x_1, @y_1), #eq(@x_2, @y_2)), #eq^#(@x_1, @y_1), #eq^#(@x_2, @y_2)) :52 -->_3 #eq^#(#s(@x), #s(@y)) -> c_51(#eq^#(@x, @y)) :51 -->_2 #eq^#(#s(@x), #s(@y)) -> c_51(#eq^#(@x, @y)) :51 -->_3 #eq^#(#s(@x), #0()) -> c_50() :50 -->_2 #eq^#(#s(@x), #0()) -> c_50() :50 -->_3 #eq^#(#pos(@x), #pos(@y)) -> c_49(#eq^#(@x, @y)) :49 -->_2 #eq^#(#pos(@x), #pos(@y)) -> c_49(#eq^#(@x, @y)) :49 -->_3 #eq^#(#pos(@x), #neg(@y)) -> c_48() :48 -->_2 #eq^#(#pos(@x), #neg(@y)) -> c_48() :48 -->_3 #eq^#(#pos(@x), #0()) -> c_47() :47 -->_2 #eq^#(#pos(@x), #0()) -> c_47() :47 -->_3 #eq^#(#neg(@x), #pos(@y)) -> c_46() :46 -->_2 #eq^#(#neg(@x), #pos(@y)) -> c_46() :46 -->_3 #eq^#(#neg(@x), #neg(@y)) -> c_45(#eq^#(@x, @y)) :45 -->_2 #eq^#(#neg(@x), #neg(@y)) -> c_45(#eq^#(@x, @y)) :45 -->_3 #eq^#(#neg(@x), #0()) -> c_44() :44 -->_2 #eq^#(#neg(@x), #0()) -> c_44() :44 -->_3 #eq^#(#0(), #s(@y)) -> c_43() :43 -->_2 #eq^#(#0(), #s(@y)) -> c_43() :43 -->_3 #eq^#(#0(), #pos(@y)) -> c_42() :42 -->_2 #eq^#(#0(), #pos(@y)) -> c_42() :42 -->_3 #eq^#(#0(), #neg(@y)) -> c_41() :41 -->_2 #eq^#(#0(), #neg(@y)) -> c_41() :41 -->_3 #eq^#(#0(), #0()) -> c_40() :40 -->_2 #eq^#(#0(), #0()) -> c_40() :40 53: #eq^#(::(@x_1, @x_2), nil()) -> c_53() 54: #eq^#(nil(), ::(@y_1, @y_2)) -> c_54() 55: #eq^#(nil(), nil()) -> c_55() 56: #ckgt^#(#EQ()) -> c_68() 57: #ckgt^#(#GT()) -> c_69() 58: #ckgt^#(#LT()) -> c_70() 59: #compare^#(#0(), #0()) -> c_56() 60: #compare^#(#0(), #neg(@y)) -> c_57() 61: #compare^#(#0(), #pos(@y)) -> c_58() 62: #compare^#(#0(), #s(@y)) -> c_59() 63: #compare^#(#neg(@x), #0()) -> c_60() 64: #compare^#(#neg(@x), #neg(@y)) -> c_61(#compare^#(@y, @x)) -->_1 #compare^#(#s(@x), #s(@y)) -> c_67(#compare^#(@x, @y)) :70 -->_1 #compare^#(#pos(@x), #pos(@y)) -> c_65(#compare^#(@x, @y)) :68 -->_1 #compare^#(#s(@x), #0()) -> c_66() :69 -->_1 #compare^#(#pos(@x), #neg(@y)) -> c_64() :67 -->_1 #compare^#(#pos(@x), #0()) -> c_63() :66 -->_1 #compare^#(#neg(@x), #pos(@y)) -> c_62() :65 -->_1 #compare^#(#neg(@x), #neg(@y)) -> c_61(#compare^#(@y, @x)) :64 -->_1 #compare^#(#neg(@x), #0()) -> c_60() :63 -->_1 #compare^#(#0(), #s(@y)) -> c_59() :62 -->_1 #compare^#(#0(), #pos(@y)) -> c_58() :61 -->_1 #compare^#(#0(), #neg(@y)) -> c_57() :60 -->_1 #compare^#(#0(), #0()) -> c_56() :59 65: #compare^#(#neg(@x), #pos(@y)) -> c_62() 66: #compare^#(#pos(@x), #0()) -> c_63() 67: #compare^#(#pos(@x), #neg(@y)) -> c_64() 68: #compare^#(#pos(@x), #pos(@y)) -> c_65(#compare^#(@x, @y)) -->_1 #compare^#(#s(@x), #s(@y)) -> c_67(#compare^#(@x, @y)) :70 -->_1 #compare^#(#s(@x), #0()) -> c_66() :69 -->_1 #compare^#(#pos(@x), #pos(@y)) -> c_65(#compare^#(@x, @y)) :68 -->_1 #compare^#(#pos(@x), #neg(@y)) -> c_64() :67 -->_1 #compare^#(#pos(@x), #0()) -> c_63() :66 -->_1 #compare^#(#neg(@x), #pos(@y)) -> c_62() :65 -->_1 #compare^#(#neg(@x), #neg(@y)) -> c_61(#compare^#(@y, @x)) :64 -->_1 #compare^#(#neg(@x), #0()) -> c_60() :63 -->_1 #compare^#(#0(), #s(@y)) -> c_59() :62 -->_1 #compare^#(#0(), #pos(@y)) -> c_58() :61 -->_1 #compare^#(#0(), #neg(@y)) -> c_57() :60 -->_1 #compare^#(#0(), #0()) -> c_56() :59 69: #compare^#(#s(@x), #0()) -> c_66() 70: #compare^#(#s(@x), #s(@y)) -> c_67(#compare^#(@x, @y)) -->_1 #compare^#(#s(@x), #s(@y)) -> c_67(#compare^#(@x, @y)) :70 -->_1 #compare^#(#s(@x), #0()) -> c_66() :69 -->_1 #compare^#(#pos(@x), #pos(@y)) -> c_65(#compare^#(@x, @y)) :68 -->_1 #compare^#(#pos(@x), #neg(@y)) -> c_64() :67 -->_1 #compare^#(#pos(@x), #0()) -> c_63() :66 -->_1 #compare^#(#neg(@x), #pos(@y)) -> c_62() :65 -->_1 #compare^#(#neg(@x), #neg(@y)) -> c_61(#compare^#(@y, @x)) :64 -->_1 #compare^#(#neg(@x), #0()) -> c_60() :63 -->_1 #compare^#(#0(), #s(@y)) -> c_59() :62 -->_1 #compare^#(#0(), #pos(@y)) -> c_58() :61 -->_1 #compare^#(#0(), #neg(@y)) -> c_57() :60 -->_1 #compare^#(#0(), #0()) -> c_56() :59 71: #add^#(#0(), @y) -> c_71() 72: #add^#(#neg(#s(#0())), @y) -> c_72(#pred^#(@y)) -->_1 #pred^#(#pos(#s(#s(@x)))) -> c_79() :83 -->_1 #pred^#(#pos(#s(#0()))) -> c_78() :82 -->_1 #pred^#(#neg(#s(@x))) -> c_77() :81 -->_1 #pred^#(#0()) -> c_76() :80 73: #add^#(#neg(#s(#s(@x))), @y) -> c_73(#pred^#(#add(#pos(#s(@x)), @y)), #add^#(#pos(#s(@x)), @y)) -->_2 #add^#(#pos(#s(#s(@x))), @y) -> c_75(#succ^#(#add(#pos(#s(@x)), @y)), #add^#(#pos(#s(@x)), @y)) :75 -->_2 #add^#(#pos(#s(#0())), @y) -> c_74(#succ^#(@y)) :74 -->_1 #pred^#(#pos(#s(#s(@x)))) -> c_79() :83 -->_1 #pred^#(#pos(#s(#0()))) -> c_78() :82 -->_1 #pred^#(#neg(#s(@x))) -> c_77() :81 -->_1 #pred^#(#0()) -> c_76() :80 74: #add^#(#pos(#s(#0())), @y) -> c_74(#succ^#(@y)) -->_1 #succ^#(#pos(#s(@x))) -> c_83() :87 -->_1 #succ^#(#neg(#s(#s(@x)))) -> c_82() :86 -->_1 #succ^#(#neg(#s(#0()))) -> c_81() :85 -->_1 #succ^#(#0()) -> c_80() :84 75: #add^#(#pos(#s(#s(@x))), @y) -> c_75(#succ^#(#add(#pos(#s(@x)), @y)), #add^#(#pos(#s(@x)), @y)) -->_1 #succ^#(#pos(#s(@x))) -> c_83() :87 -->_1 #succ^#(#neg(#s(#s(@x)))) -> c_82() :86 -->_1 #succ^#(#neg(#s(#0()))) -> c_81() :85 -->_1 #succ^#(#0()) -> c_80() :84 -->_2 #add^#(#pos(#s(#s(@x))), @y) -> c_75(#succ^#(#add(#pos(#s(@x)), @y)), #add^#(#pos(#s(@x)), @y)) :75 -->_2 #add^#(#pos(#s(#0())), @y) -> c_74(#succ^#(@y)) :74 76: #and^#(#false(), #false()) -> c_84() 77: #and^#(#false(), #true()) -> c_85() 78: #and^#(#true(), #false()) -> c_86() 79: #and^#(#true(), #true()) -> c_87() 80: #pred^#(#0()) -> c_76() 81: #pred^#(#neg(#s(@x))) -> c_77() 82: #pred^#(#pos(#s(#0()))) -> c_78() 83: #pred^#(#pos(#s(#s(@x)))) -> c_79() 84: #succ^#(#0()) -> c_80() 85: #succ^#(#neg(#s(#0()))) -> c_81() 86: #succ^#(#neg(#s(#s(@x)))) -> c_82() 87: #succ^#(#pos(#s(@x))) -> c_83() Following roots of the dependency graph are removed, as the considered set of starting terms is closed under reduction with respect to these rules (modulo compound contexts). { #abs^#(#neg(@x)) -> c_2() , #abs^#(#pos(@x)) -> c_3() , #abs^#(#s(@x)) -> c_4() } We are left with following problem, upon which TcT provides the certificate YES(O(1),O(n^2)). Strict DPs: { #abs^#(#0()) -> c_1() , #equal^#(@x, @y) -> c_5(#eq^#(@x, @y)) , #greater^#(@x, @y) -> c_6(#ckgt^#(#compare(@x, @y)), #compare^#(@x, @y)) , +^#(@x, @y) -> c_7(#add^#(@x, @y)) , firstline^#(@l) -> c_8(firstline#1^#(@l)) , firstline#1^#(::(@x, @xs)) -> c_9(#abs^#(#0()), firstline^#(@xs)) , firstline#1^#(nil()) -> c_10() , lcs^#(@l1, @l2) -> c_11(lcs#1^#(lcstable(@l1, @l2)), lcstable^#(@l1, @l2)) , lcs#1^#(@m) -> c_13(lcs#2^#(@m)) , lcstable^#(@l1, @l2) -> c_12(lcstable#1^#(@l1, @l2)) , lcstable#1^#(::(@x, @xs), @l2) -> c_18(lcstable#2^#(lcstable(@xs, @l2), @l2, @x), lcstable^#(@xs, @l2)) , lcstable#1^#(nil(), @l2) -> c_19(firstline^#(@l2)) , lcs#2^#(::(@l1, @_@2)) -> c_14(lcs#3^#(@l1)) , lcs#2^#(nil()) -> c_15(#abs^#(#0())) , lcs#3^#(::(@len, @_@1)) -> c_16() , lcs#3^#(nil()) -> c_17(#abs^#(#0())) , lcstable#2^#(@m, @l2, @x) -> c_20(lcstable#3^#(@m, @l2, @x)) , lcstable#3^#(::(@l, @ls), @l2, @x) -> c_21(newline^#(@x, @l, @l2)) , lcstable#3^#(nil(), @l2, @x) -> c_22() , newline^#(@y, @lastline, @l) -> c_23(newline#1^#(@l, @lastline, @y)) , newline#1^#(::(@x, @xs), @lastline, @y) -> c_27(newline#2^#(@lastline, @x, @xs, @y)) , newline#1^#(nil(), @lastline, @y) -> c_28() , max^#(@a, @b) -> c_24(max#1^#(#greater(@a, @b), @a, @b), #greater^#(@a, @b)) , max#1^#(#false(), @a, @b) -> c_25() , max#1^#(#true(), @a, @b) -> c_26() , newline#2^#(::(@belowVal, @lastline'), @x, @xs, @y) -> c_29(newline#3^#(newline(@y, @lastline', @xs), @belowVal, @lastline', @x, @y), newline^#(@y, @lastline', @xs)) , newline#2^#(nil(), @x, @xs, @y) -> c_30() , newline#3^#(@nl, @belowVal, @lastline', @x, @y) -> c_31(newline#4^#(right(@nl), @belowVal, @lastline', @nl, @x, @y), right^#(@nl)) , newline#4^#(@rightVal, @belowVal, @lastline', @nl, @x, @y) -> c_33(newline#5^#(right(@lastline'), @belowVal, @nl, @rightVal, @x, @y), right^#(@lastline')) , right^#(@l) -> c_32(right#1^#(@l)) , right#1^#(::(@x, @xs)) -> c_38() , right#1^#(nil()) -> c_39(#abs^#(#0())) , newline#5^#(@diagVal, @belowVal, @nl, @rightVal, @x, @y) -> c_34(newline#6^#(newline#7(#equal(@x, @y), @belowVal, @diagVal, @rightVal), @nl), newline#7^#(#equal(@x, @y), @belowVal, @diagVal, @rightVal), #equal^#(@x, @y)) , newline#6^#(@elem, @nl) -> c_37() , newline#7^#(#false(), @belowVal, @diagVal, @rightVal) -> c_35(max^#(@belowVal, @rightVal)) , newline#7^#(#true(), @belowVal, @diagVal, @rightVal) -> c_36(+^#(@diagVal, #pos(#s(#0())))) } Weak DPs: { #eq^#(#0(), #0()) -> c_40() , #eq^#(#0(), #neg(@y)) -> c_41() , #eq^#(#0(), #pos(@y)) -> c_42() , #eq^#(#0(), #s(@y)) -> c_43() , #eq^#(#neg(@x), #0()) -> c_44() , #eq^#(#neg(@x), #neg(@y)) -> c_45(#eq^#(@x, @y)) , #eq^#(#neg(@x), #pos(@y)) -> c_46() , #eq^#(#pos(@x), #0()) -> c_47() , #eq^#(#pos(@x), #neg(@y)) -> c_48() , #eq^#(#pos(@x), #pos(@y)) -> c_49(#eq^#(@x, @y)) , #eq^#(#s(@x), #0()) -> c_50() , #eq^#(#s(@x), #s(@y)) -> c_51(#eq^#(@x, @y)) , #eq^#(::(@x_1, @x_2), ::(@y_1, @y_2)) -> c_52(#and^#(#eq(@x_1, @y_1), #eq(@x_2, @y_2)), #eq^#(@x_1, @y_1), #eq^#(@x_2, @y_2)) , #eq^#(::(@x_1, @x_2), nil()) -> c_53() , #eq^#(nil(), ::(@y_1, @y_2)) -> c_54() , #eq^#(nil(), nil()) -> c_55() , #ckgt^#(#EQ()) -> c_68() , #ckgt^#(#GT()) -> c_69() , #ckgt^#(#LT()) -> c_70() , #compare^#(#0(), #0()) -> c_56() , #compare^#(#0(), #neg(@y)) -> c_57() , #compare^#(#0(), #pos(@y)) -> c_58() , #compare^#(#0(), #s(@y)) -> c_59() , #compare^#(#neg(@x), #0()) -> c_60() , #compare^#(#neg(@x), #neg(@y)) -> c_61(#compare^#(@y, @x)) , #compare^#(#neg(@x), #pos(@y)) -> c_62() , #compare^#(#pos(@x), #0()) -> c_63() , #compare^#(#pos(@x), #neg(@y)) -> c_64() , #compare^#(#pos(@x), #pos(@y)) -> c_65(#compare^#(@x, @y)) , #compare^#(#s(@x), #0()) -> c_66() , #compare^#(#s(@x), #s(@y)) -> c_67(#compare^#(@x, @y)) , #add^#(#0(), @y) -> c_71() , #add^#(#neg(#s(#0())), @y) -> c_72(#pred^#(@y)) , #add^#(#neg(#s(#s(@x))), @y) -> c_73(#pred^#(#add(#pos(#s(@x)), @y)), #add^#(#pos(#s(@x)), @y)) , #add^#(#pos(#s(#0())), @y) -> c_74(#succ^#(@y)) , #add^#(#pos(#s(#s(@x))), @y) -> c_75(#succ^#(#add(#pos(#s(@x)), @y)), #add^#(#pos(#s(@x)), @y)) , #and^#(#false(), #false()) -> c_84() , #and^#(#false(), #true()) -> c_85() , #and^#(#true(), #false()) -> c_86() , #and^#(#true(), #true()) -> c_87() , #pred^#(#0()) -> c_76() , #pred^#(#neg(#s(@x))) -> c_77() , #pred^#(#pos(#s(#0()))) -> c_78() , #pred^#(#pos(#s(#s(@x)))) -> c_79() , #succ^#(#0()) -> c_80() , #succ^#(#neg(#s(#0()))) -> c_81() , #succ^#(#neg(#s(#s(@x)))) -> c_82() , #succ^#(#pos(#s(@x))) -> c_83() } Weak Trs: { #abs(#0()) -> #0() , #abs(#neg(@x)) -> #pos(@x) , #abs(#pos(@x)) -> #pos(@x) , #abs(#s(@x)) -> #pos(#s(@x)) , #equal(@x, @y) -> #eq(@x, @y) , #eq(#0(), #0()) -> #true() , #eq(#0(), #neg(@y)) -> #false() , #eq(#0(), #pos(@y)) -> #false() , #eq(#0(), #s(@y)) -> #false() , #eq(#neg(@x), #0()) -> #false() , #eq(#neg(@x), #neg(@y)) -> #eq(@x, @y) , #eq(#neg(@x), #pos(@y)) -> #false() , #eq(#pos(@x), #0()) -> #false() , #eq(#pos(@x), #neg(@y)) -> #false() , #eq(#pos(@x), #pos(@y)) -> #eq(@x, @y) , #eq(#s(@x), #0()) -> #false() , #eq(#s(@x), #s(@y)) -> #eq(@x, @y) , #eq(::(@x_1, @x_2), ::(@y_1, @y_2)) -> #and(#eq(@x_1, @y_1), #eq(@x_2, @y_2)) , #eq(::(@x_1, @x_2), nil()) -> #false() , #eq(nil(), ::(@y_1, @y_2)) -> #false() , #eq(nil(), nil()) -> #true() , #greater(@x, @y) -> #ckgt(#compare(@x, @y)) , #compare(#0(), #0()) -> #EQ() , #compare(#0(), #neg(@y)) -> #GT() , #compare(#0(), #pos(@y)) -> #LT() , #compare(#0(), #s(@y)) -> #LT() , #compare(#neg(@x), #0()) -> #LT() , #compare(#neg(@x), #neg(@y)) -> #compare(@y, @x) , #compare(#neg(@x), #pos(@y)) -> #LT() , #compare(#pos(@x), #0()) -> #GT() , #compare(#pos(@x), #neg(@y)) -> #GT() , #compare(#pos(@x), #pos(@y)) -> #compare(@x, @y) , #compare(#s(@x), #0()) -> #GT() , #compare(#s(@x), #s(@y)) -> #compare(@x, @y) , #ckgt(#EQ()) -> #false() , #ckgt(#GT()) -> #true() , #ckgt(#LT()) -> #false() , +(@x, @y) -> #add(@x, @y) , #add(#0(), @y) -> @y , #add(#neg(#s(#0())), @y) -> #pred(@y) , #add(#neg(#s(#s(@x))), @y) -> #pred(#add(#pos(#s(@x)), @y)) , #add(#pos(#s(#0())), @y) -> #succ(@y) , #add(#pos(#s(#s(@x))), @y) -> #succ(#add(#pos(#s(@x)), @y)) , firstline(@l) -> firstline#1(@l) , firstline#1(::(@x, @xs)) -> ::(#abs(#0()), firstline(@xs)) , firstline#1(nil()) -> nil() , lcs(@l1, @l2) -> lcs#1(lcstable(@l1, @l2)) , lcstable(@l1, @l2) -> lcstable#1(@l1, @l2) , lcs#1(@m) -> lcs#2(@m) , lcs#2(::(@l1, @_@2)) -> lcs#3(@l1) , lcs#2(nil()) -> #abs(#0()) , lcs#3(::(@len, @_@1)) -> @len , lcs#3(nil()) -> #abs(#0()) , lcstable#1(::(@x, @xs), @l2) -> lcstable#2(lcstable(@xs, @l2), @l2, @x) , lcstable#1(nil(), @l2) -> ::(firstline(@l2), nil()) , lcstable#2(@m, @l2, @x) -> lcstable#3(@m, @l2, @x) , lcstable#3(::(@l, @ls), @l2, @x) -> ::(newline(@x, @l, @l2), ::(@l, @ls)) , lcstable#3(nil(), @l2, @x) -> nil() , newline(@y, @lastline, @l) -> newline#1(@l, @lastline, @y) , max(@a, @b) -> max#1(#greater(@a, @b), @a, @b) , max#1(#false(), @a, @b) -> @b , max#1(#true(), @a, @b) -> @a , newline#1(::(@x, @xs), @lastline, @y) -> newline#2(@lastline, @x, @xs, @y) , newline#1(nil(), @lastline, @y) -> nil() , newline#2(::(@belowVal, @lastline'), @x, @xs, @y) -> newline#3(newline(@y, @lastline', @xs), @belowVal, @lastline', @x, @y) , newline#2(nil(), @x, @xs, @y) -> nil() , newline#3(@nl, @belowVal, @lastline', @x, @y) -> newline#4(right(@nl), @belowVal, @lastline', @nl, @x, @y) , right(@l) -> right#1(@l) , newline#4(@rightVal, @belowVal, @lastline', @nl, @x, @y) -> newline#5(right(@lastline'), @belowVal, @nl, @rightVal, @x, @y) , newline#5(@diagVal, @belowVal, @nl, @rightVal, @x, @y) -> newline#6(newline#7(#equal(@x, @y), @belowVal, @diagVal, @rightVal), @nl) , newline#7(#false(), @belowVal, @diagVal, @rightVal) -> max(@belowVal, @rightVal) , newline#7(#true(), @belowVal, @diagVal, @rightVal) -> +(@diagVal, #pos(#s(#0()))) , newline#6(@elem, @nl) -> ::(@elem, @nl) , right#1(::(@x, @xs)) -> @x , right#1(nil()) -> #abs(#0()) , #pred(#0()) -> #neg(#s(#0())) , #pred(#neg(#s(@x))) -> #neg(#s(#s(@x))) , #pred(#pos(#s(#0()))) -> #0() , #pred(#pos(#s(#s(@x)))) -> #pos(#s(@x)) , #succ(#0()) -> #pos(#s(#0())) , #succ(#neg(#s(#0()))) -> #0() , #succ(#neg(#s(#s(@x)))) -> #neg(#s(@x)) , #succ(#pos(#s(@x))) -> #pos(#s(#s(@x))) , #and(#false(), #false()) -> #false() , #and(#false(), #true()) -> #false() , #and(#true(), #false()) -> #false() , #and(#true(), #true()) -> #true() } Obligation: innermost runtime complexity Answer: YES(O(1),O(n^2)) We estimate the number of application of {1,2,3,4,7,15,19,22,24,25,27,31,34} by applications of Pre({1,2,3,4,7,15,19,22,24,25,27,31,34}) = {5,6,13,14,16,17,20,21,23,30,32,33,36}. Here rules are labeled as follows: DPs: { 1: #abs^#(#0()) -> c_1() , 2: #equal^#(@x, @y) -> c_5(#eq^#(@x, @y)) , 3: #greater^#(@x, @y) -> c_6(#ckgt^#(#compare(@x, @y)), #compare^#(@x, @y)) , 4: +^#(@x, @y) -> c_7(#add^#(@x, @y)) , 5: firstline^#(@l) -> c_8(firstline#1^#(@l)) , 6: firstline#1^#(::(@x, @xs)) -> c_9(#abs^#(#0()), firstline^#(@xs)) , 7: firstline#1^#(nil()) -> c_10() , 8: lcs^#(@l1, @l2) -> c_11(lcs#1^#(lcstable(@l1, @l2)), lcstable^#(@l1, @l2)) , 9: lcs#1^#(@m) -> c_13(lcs#2^#(@m)) , 10: lcstable^#(@l1, @l2) -> c_12(lcstable#1^#(@l1, @l2)) , 11: lcstable#1^#(::(@x, @xs), @l2) -> c_18(lcstable#2^#(lcstable(@xs, @l2), @l2, @x), lcstable^#(@xs, @l2)) , 12: lcstable#1^#(nil(), @l2) -> c_19(firstline^#(@l2)) , 13: lcs#2^#(::(@l1, @_@2)) -> c_14(lcs#3^#(@l1)) , 14: lcs#2^#(nil()) -> c_15(#abs^#(#0())) , 15: lcs#3^#(::(@len, @_@1)) -> c_16() , 16: lcs#3^#(nil()) -> c_17(#abs^#(#0())) , 17: lcstable#2^#(@m, @l2, @x) -> c_20(lcstable#3^#(@m, @l2, @x)) , 18: lcstable#3^#(::(@l, @ls), @l2, @x) -> c_21(newline^#(@x, @l, @l2)) , 19: lcstable#3^#(nil(), @l2, @x) -> c_22() , 20: newline^#(@y, @lastline, @l) -> c_23(newline#1^#(@l, @lastline, @y)) , 21: newline#1^#(::(@x, @xs), @lastline, @y) -> c_27(newline#2^#(@lastline, @x, @xs, @y)) , 22: newline#1^#(nil(), @lastline, @y) -> c_28() , 23: max^#(@a, @b) -> c_24(max#1^#(#greater(@a, @b), @a, @b), #greater^#(@a, @b)) , 24: max#1^#(#false(), @a, @b) -> c_25() , 25: max#1^#(#true(), @a, @b) -> c_26() , 26: newline#2^#(::(@belowVal, @lastline'), @x, @xs, @y) -> c_29(newline#3^#(newline(@y, @lastline', @xs), @belowVal, @lastline', @x, @y), newline^#(@y, @lastline', @xs)) , 27: newline#2^#(nil(), @x, @xs, @y) -> c_30() , 28: newline#3^#(@nl, @belowVal, @lastline', @x, @y) -> c_31(newline#4^#(right(@nl), @belowVal, @lastline', @nl, @x, @y), right^#(@nl)) , 29: newline#4^#(@rightVal, @belowVal, @lastline', @nl, @x, @y) -> c_33(newline#5^#(right(@lastline'), @belowVal, @nl, @rightVal, @x, @y), right^#(@lastline')) , 30: right^#(@l) -> c_32(right#1^#(@l)) , 31: right#1^#(::(@x, @xs)) -> c_38() , 32: right#1^#(nil()) -> c_39(#abs^#(#0())) , 33: newline#5^#(@diagVal, @belowVal, @nl, @rightVal, @x, @y) -> c_34(newline#6^#(newline#7(#equal(@x, @y), @belowVal, @diagVal, @rightVal), @nl), newline#7^#(#equal(@x, @y), @belowVal, @diagVal, @rightVal), #equal^#(@x, @y)) , 34: newline#6^#(@elem, @nl) -> c_37() , 35: newline#7^#(#false(), @belowVal, @diagVal, @rightVal) -> c_35(max^#(@belowVal, @rightVal)) , 36: newline#7^#(#true(), @belowVal, @diagVal, @rightVal) -> c_36(+^#(@diagVal, #pos(#s(#0())))) , 37: #eq^#(#0(), #0()) -> c_40() , 38: #eq^#(#0(), #neg(@y)) -> c_41() , 39: #eq^#(#0(), #pos(@y)) -> c_42() , 40: #eq^#(#0(), #s(@y)) -> c_43() , 41: #eq^#(#neg(@x), #0()) -> c_44() , 42: #eq^#(#neg(@x), #neg(@y)) -> c_45(#eq^#(@x, @y)) , 43: #eq^#(#neg(@x), #pos(@y)) -> c_46() , 44: #eq^#(#pos(@x), #0()) -> c_47() , 45: #eq^#(#pos(@x), #neg(@y)) -> c_48() , 46: #eq^#(#pos(@x), #pos(@y)) -> c_49(#eq^#(@x, @y)) , 47: #eq^#(#s(@x), #0()) -> c_50() , 48: #eq^#(#s(@x), #s(@y)) -> c_51(#eq^#(@x, @y)) , 49: #eq^#(::(@x_1, @x_2), ::(@y_1, @y_2)) -> c_52(#and^#(#eq(@x_1, @y_1), #eq(@x_2, @y_2)), #eq^#(@x_1, @y_1), #eq^#(@x_2, @y_2)) , 50: #eq^#(::(@x_1, @x_2), nil()) -> c_53() , 51: #eq^#(nil(), ::(@y_1, @y_2)) -> c_54() , 52: #eq^#(nil(), nil()) -> c_55() , 53: #ckgt^#(#EQ()) -> c_68() , 54: #ckgt^#(#GT()) -> c_69() , 55: #ckgt^#(#LT()) -> c_70() , 56: #compare^#(#0(), #0()) -> c_56() , 57: #compare^#(#0(), #neg(@y)) -> c_57() , 58: #compare^#(#0(), #pos(@y)) -> c_58() , 59: #compare^#(#0(), #s(@y)) -> c_59() , 60: #compare^#(#neg(@x), #0()) -> c_60() , 61: #compare^#(#neg(@x), #neg(@y)) -> c_61(#compare^#(@y, @x)) , 62: #compare^#(#neg(@x), #pos(@y)) -> c_62() , 63: #compare^#(#pos(@x), #0()) -> c_63() , 64: #compare^#(#pos(@x), #neg(@y)) -> c_64() , 65: #compare^#(#pos(@x), #pos(@y)) -> c_65(#compare^#(@x, @y)) , 66: #compare^#(#s(@x), #0()) -> c_66() , 67: #compare^#(#s(@x), #s(@y)) -> c_67(#compare^#(@x, @y)) , 68: #add^#(#0(), @y) -> c_71() , 69: #add^#(#neg(#s(#0())), @y) -> c_72(#pred^#(@y)) , 70: #add^#(#neg(#s(#s(@x))), @y) -> c_73(#pred^#(#add(#pos(#s(@x)), @y)), #add^#(#pos(#s(@x)), @y)) , 71: #add^#(#pos(#s(#0())), @y) -> c_74(#succ^#(@y)) , 72: #add^#(#pos(#s(#s(@x))), @y) -> c_75(#succ^#(#add(#pos(#s(@x)), @y)), #add^#(#pos(#s(@x)), @y)) , 73: #and^#(#false(), #false()) -> c_84() , 74: #and^#(#false(), #true()) -> c_85() , 75: #and^#(#true(), #false()) -> c_86() , 76: #and^#(#true(), #true()) -> c_87() , 77: #pred^#(#0()) -> c_76() , 78: #pred^#(#neg(#s(@x))) -> c_77() , 79: #pred^#(#pos(#s(#0()))) -> c_78() , 80: #pred^#(#pos(#s(#s(@x)))) -> c_79() , 81: #succ^#(#0()) -> c_80() , 82: #succ^#(#neg(#s(#0()))) -> c_81() , 83: #succ^#(#neg(#s(#s(@x)))) -> c_82() , 84: #succ^#(#pos(#s(@x))) -> c_83() } We are left with following problem, upon which TcT provides the certificate YES(O(1),O(n^2)). Strict DPs: { firstline^#(@l) -> c_8(firstline#1^#(@l)) , firstline#1^#(::(@x, @xs)) -> c_9(#abs^#(#0()), firstline^#(@xs)) , lcs^#(@l1, @l2) -> c_11(lcs#1^#(lcstable(@l1, @l2)), lcstable^#(@l1, @l2)) , lcs#1^#(@m) -> c_13(lcs#2^#(@m)) , lcstable^#(@l1, @l2) -> c_12(lcstable#1^#(@l1, @l2)) , lcstable#1^#(::(@x, @xs), @l2) -> c_18(lcstable#2^#(lcstable(@xs, @l2), @l2, @x), lcstable^#(@xs, @l2)) , lcstable#1^#(nil(), @l2) -> c_19(firstline^#(@l2)) , lcs#2^#(::(@l1, @_@2)) -> c_14(lcs#3^#(@l1)) , lcs#2^#(nil()) -> c_15(#abs^#(#0())) , lcs#3^#(nil()) -> c_17(#abs^#(#0())) , lcstable#2^#(@m, @l2, @x) -> c_20(lcstable#3^#(@m, @l2, @x)) , lcstable#3^#(::(@l, @ls), @l2, @x) -> c_21(newline^#(@x, @l, @l2)) , newline^#(@y, @lastline, @l) -> c_23(newline#1^#(@l, @lastline, @y)) , newline#1^#(::(@x, @xs), @lastline, @y) -> c_27(newline#2^#(@lastline, @x, @xs, @y)) , max^#(@a, @b) -> c_24(max#1^#(#greater(@a, @b), @a, @b), #greater^#(@a, @b)) , newline#2^#(::(@belowVal, @lastline'), @x, @xs, @y) -> c_29(newline#3^#(newline(@y, @lastline', @xs), @belowVal, @lastline', @x, @y), newline^#(@y, @lastline', @xs)) , newline#3^#(@nl, @belowVal, @lastline', @x, @y) -> c_31(newline#4^#(right(@nl), @belowVal, @lastline', @nl, @x, @y), right^#(@nl)) , newline#4^#(@rightVal, @belowVal, @lastline', @nl, @x, @y) -> c_33(newline#5^#(right(@lastline'), @belowVal, @nl, @rightVal, @x, @y), right^#(@lastline')) , right^#(@l) -> c_32(right#1^#(@l)) , right#1^#(nil()) -> c_39(#abs^#(#0())) , newline#5^#(@diagVal, @belowVal, @nl, @rightVal, @x, @y) -> c_34(newline#6^#(newline#7(#equal(@x, @y), @belowVal, @diagVal, @rightVal), @nl), newline#7^#(#equal(@x, @y), @belowVal, @diagVal, @rightVal), #equal^#(@x, @y)) , newline#7^#(#false(), @belowVal, @diagVal, @rightVal) -> c_35(max^#(@belowVal, @rightVal)) , newline#7^#(#true(), @belowVal, @diagVal, @rightVal) -> c_36(+^#(@diagVal, #pos(#s(#0())))) } Weak DPs: { #abs^#(#0()) -> c_1() , #equal^#(@x, @y) -> c_5(#eq^#(@x, @y)) , #eq^#(#0(), #0()) -> c_40() , #eq^#(#0(), #neg(@y)) -> c_41() , #eq^#(#0(), #pos(@y)) -> c_42() , #eq^#(#0(), #s(@y)) -> c_43() , #eq^#(#neg(@x), #0()) -> c_44() , #eq^#(#neg(@x), #neg(@y)) -> c_45(#eq^#(@x, @y)) , #eq^#(#neg(@x), #pos(@y)) -> c_46() , #eq^#(#pos(@x), #0()) -> c_47() , #eq^#(#pos(@x), #neg(@y)) -> c_48() , #eq^#(#pos(@x), #pos(@y)) -> c_49(#eq^#(@x, @y)) , #eq^#(#s(@x), #0()) -> c_50() , #eq^#(#s(@x), #s(@y)) -> c_51(#eq^#(@x, @y)) , #eq^#(::(@x_1, @x_2), ::(@y_1, @y_2)) -> c_52(#and^#(#eq(@x_1, @y_1), #eq(@x_2, @y_2)), #eq^#(@x_1, @y_1), #eq^#(@x_2, @y_2)) , #eq^#(::(@x_1, @x_2), nil()) -> c_53() , #eq^#(nil(), ::(@y_1, @y_2)) -> c_54() , #eq^#(nil(), nil()) -> c_55() , #greater^#(@x, @y) -> c_6(#ckgt^#(#compare(@x, @y)), #compare^#(@x, @y)) , #ckgt^#(#EQ()) -> c_68() , #ckgt^#(#GT()) -> c_69() , #ckgt^#(#LT()) -> c_70() , #compare^#(#0(), #0()) -> c_56() , #compare^#(#0(), #neg(@y)) -> c_57() , #compare^#(#0(), #pos(@y)) -> c_58() , #compare^#(#0(), #s(@y)) -> c_59() , #compare^#(#neg(@x), #0()) -> c_60() , #compare^#(#neg(@x), #neg(@y)) -> c_61(#compare^#(@y, @x)) , #compare^#(#neg(@x), #pos(@y)) -> c_62() , #compare^#(#pos(@x), #0()) -> c_63() , #compare^#(#pos(@x), #neg(@y)) -> c_64() , #compare^#(#pos(@x), #pos(@y)) -> c_65(#compare^#(@x, @y)) , #compare^#(#s(@x), #0()) -> c_66() , #compare^#(#s(@x), #s(@y)) -> c_67(#compare^#(@x, @y)) , +^#(@x, @y) -> c_7(#add^#(@x, @y)) , #add^#(#0(), @y) -> c_71() , #add^#(#neg(#s(#0())), @y) -> c_72(#pred^#(@y)) , #add^#(#neg(#s(#s(@x))), @y) -> c_73(#pred^#(#add(#pos(#s(@x)), @y)), #add^#(#pos(#s(@x)), @y)) , #add^#(#pos(#s(#0())), @y) -> c_74(#succ^#(@y)) , #add^#(#pos(#s(#s(@x))), @y) -> c_75(#succ^#(#add(#pos(#s(@x)), @y)), #add^#(#pos(#s(@x)), @y)) , firstline#1^#(nil()) -> c_10() , lcs#3^#(::(@len, @_@1)) -> c_16() , lcstable#3^#(nil(), @l2, @x) -> c_22() , newline#1^#(nil(), @lastline, @y) -> c_28() , max#1^#(#false(), @a, @b) -> c_25() , max#1^#(#true(), @a, @b) -> c_26() , newline#2^#(nil(), @x, @xs, @y) -> c_30() , right#1^#(::(@x, @xs)) -> c_38() , newline#6^#(@elem, @nl) -> c_37() , #and^#(#false(), #false()) -> c_84() , #and^#(#false(), #true()) -> c_85() , #and^#(#true(), #false()) -> c_86() , #and^#(#true(), #true()) -> c_87() , #pred^#(#0()) -> c_76() , #pred^#(#neg(#s(@x))) -> c_77() , #pred^#(#pos(#s(#0()))) -> c_78() , #pred^#(#pos(#s(#s(@x)))) -> c_79() , #succ^#(#0()) -> c_80() , #succ^#(#neg(#s(#0()))) -> c_81() , #succ^#(#neg(#s(#s(@x)))) -> c_82() , #succ^#(#pos(#s(@x))) -> c_83() } Weak Trs: { #abs(#0()) -> #0() , #abs(#neg(@x)) -> #pos(@x) , #abs(#pos(@x)) -> #pos(@x) , #abs(#s(@x)) -> #pos(#s(@x)) , #equal(@x, @y) -> #eq(@x, @y) , #eq(#0(), #0()) -> #true() , #eq(#0(), #neg(@y)) -> #false() , #eq(#0(), #pos(@y)) -> #false() , #eq(#0(), #s(@y)) -> #false() , #eq(#neg(@x), #0()) -> #false() , #eq(#neg(@x), #neg(@y)) -> #eq(@x, @y) , #eq(#neg(@x), #pos(@y)) -> #false() , #eq(#pos(@x), #0()) -> #false() , #eq(#pos(@x), #neg(@y)) -> #false() , #eq(#pos(@x), #pos(@y)) -> #eq(@x, @y) , #eq(#s(@x), #0()) -> #false() , #eq(#s(@x), #s(@y)) -> #eq(@x, @y) , #eq(::(@x_1, @x_2), ::(@y_1, @y_2)) -> #and(#eq(@x_1, @y_1), #eq(@x_2, @y_2)) , #eq(::(@x_1, @x_2), nil()) -> #false() , #eq(nil(), ::(@y_1, @y_2)) -> #false() , #eq(nil(), nil()) -> #true() , #greater(@x, @y) -> #ckgt(#compare(@x, @y)) , #compare(#0(), #0()) -> #EQ() , #compare(#0(), #neg(@y)) -> #GT() , #compare(#0(), #pos(@y)) -> #LT() , #compare(#0(), #s(@y)) -> #LT() , #compare(#neg(@x), #0()) -> #LT() , #compare(#neg(@x), #neg(@y)) -> #compare(@y, @x) , #compare(#neg(@x), #pos(@y)) -> #LT() , #compare(#pos(@x), #0()) -> #GT() , #compare(#pos(@x), #neg(@y)) -> #GT() , #compare(#pos(@x), #pos(@y)) -> #compare(@x, @y) , #compare(#s(@x), #0()) -> #GT() , #compare(#s(@x), #s(@y)) -> #compare(@x, @y) , #ckgt(#EQ()) -> #false() , #ckgt(#GT()) -> #true() , #ckgt(#LT()) -> #false() , +(@x, @y) -> #add(@x, @y) , #add(#0(), @y) -> @y , #add(#neg(#s(#0())), @y) -> #pred(@y) , #add(#neg(#s(#s(@x))), @y) -> #pred(#add(#pos(#s(@x)), @y)) , #add(#pos(#s(#0())), @y) -> #succ(@y) , #add(#pos(#s(#s(@x))), @y) -> #succ(#add(#pos(#s(@x)), @y)) , firstline(@l) -> firstline#1(@l) , firstline#1(::(@x, @xs)) -> ::(#abs(#0()), firstline(@xs)) , firstline#1(nil()) -> nil() , lcs(@l1, @l2) -> lcs#1(lcstable(@l1, @l2)) , lcstable(@l1, @l2) -> lcstable#1(@l1, @l2) , lcs#1(@m) -> lcs#2(@m) , lcs#2(::(@l1, @_@2)) -> lcs#3(@l1) , lcs#2(nil()) -> #abs(#0()) , lcs#3(::(@len, @_@1)) -> @len , lcs#3(nil()) -> #abs(#0()) , lcstable#1(::(@x, @xs), @l2) -> lcstable#2(lcstable(@xs, @l2), @l2, @x) , lcstable#1(nil(), @l2) -> ::(firstline(@l2), nil()) , lcstable#2(@m, @l2, @x) -> lcstable#3(@m, @l2, @x) , lcstable#3(::(@l, @ls), @l2, @x) -> ::(newline(@x, @l, @l2), ::(@l, @ls)) , lcstable#3(nil(), @l2, @x) -> nil() , newline(@y, @lastline, @l) -> newline#1(@l, @lastline, @y) , max(@a, @b) -> max#1(#greater(@a, @b), @a, @b) , max#1(#false(), @a, @b) -> @b , max#1(#true(), @a, @b) -> @a , newline#1(::(@x, @xs), @lastline, @y) -> newline#2(@lastline, @x, @xs, @y) , newline#1(nil(), @lastline, @y) -> nil() , newline#2(::(@belowVal, @lastline'), @x, @xs, @y) -> newline#3(newline(@y, @lastline', @xs), @belowVal, @lastline', @x, @y) , newline#2(nil(), @x, @xs, @y) -> nil() , newline#3(@nl, @belowVal, @lastline', @x, @y) -> newline#4(right(@nl), @belowVal, @lastline', @nl, @x, @y) , right(@l) -> right#1(@l) , newline#4(@rightVal, @belowVal, @lastline', @nl, @x, @y) -> newline#5(right(@lastline'), @belowVal, @nl, @rightVal, @x, @y) , newline#5(@diagVal, @belowVal, @nl, @rightVal, @x, @y) -> newline#6(newline#7(#equal(@x, @y), @belowVal, @diagVal, @rightVal), @nl) , newline#7(#false(), @belowVal, @diagVal, @rightVal) -> max(@belowVal, @rightVal) , newline#7(#true(), @belowVal, @diagVal, @rightVal) -> +(@diagVal, #pos(#s(#0()))) , newline#6(@elem, @nl) -> ::(@elem, @nl) , right#1(::(@x, @xs)) -> @x , right#1(nil()) -> #abs(#0()) , #pred(#0()) -> #neg(#s(#0())) , #pred(#neg(#s(@x))) -> #neg(#s(#s(@x))) , #pred(#pos(#s(#0()))) -> #0() , #pred(#pos(#s(#s(@x)))) -> #pos(#s(@x)) , #succ(#0()) -> #pos(#s(#0())) , #succ(#neg(#s(#0()))) -> #0() , #succ(#neg(#s(#s(@x)))) -> #neg(#s(@x)) , #succ(#pos(#s(@x))) -> #pos(#s(#s(@x))) , #and(#false(), #false()) -> #false() , #and(#false(), #true()) -> #false() , #and(#true(), #false()) -> #false() , #and(#true(), #true()) -> #true() } Obligation: innermost runtime complexity Answer: YES(O(1),O(n^2)) We estimate the number of application of {9,10,15,20,23} by applications of Pre({9,10,15,20,23}) = {4,8,19,21,22}. Here rules are labeled as follows: DPs: { 1: firstline^#(@l) -> c_8(firstline#1^#(@l)) , 2: firstline#1^#(::(@x, @xs)) -> c_9(#abs^#(#0()), firstline^#(@xs)) , 3: lcs^#(@l1, @l2) -> c_11(lcs#1^#(lcstable(@l1, @l2)), lcstable^#(@l1, @l2)) , 4: lcs#1^#(@m) -> c_13(lcs#2^#(@m)) , 5: lcstable^#(@l1, @l2) -> c_12(lcstable#1^#(@l1, @l2)) , 6: lcstable#1^#(::(@x, @xs), @l2) -> c_18(lcstable#2^#(lcstable(@xs, @l2), @l2, @x), lcstable^#(@xs, @l2)) , 7: lcstable#1^#(nil(), @l2) -> c_19(firstline^#(@l2)) , 8: lcs#2^#(::(@l1, @_@2)) -> c_14(lcs#3^#(@l1)) , 9: lcs#2^#(nil()) -> c_15(#abs^#(#0())) , 10: lcs#3^#(nil()) -> c_17(#abs^#(#0())) , 11: lcstable#2^#(@m, @l2, @x) -> c_20(lcstable#3^#(@m, @l2, @x)) , 12: lcstable#3^#(::(@l, @ls), @l2, @x) -> c_21(newline^#(@x, @l, @l2)) , 13: newline^#(@y, @lastline, @l) -> c_23(newline#1^#(@l, @lastline, @y)) , 14: newline#1^#(::(@x, @xs), @lastline, @y) -> c_27(newline#2^#(@lastline, @x, @xs, @y)) , 15: max^#(@a, @b) -> c_24(max#1^#(#greater(@a, @b), @a, @b), #greater^#(@a, @b)) , 16: newline#2^#(::(@belowVal, @lastline'), @x, @xs, @y) -> c_29(newline#3^#(newline(@y, @lastline', @xs), @belowVal, @lastline', @x, @y), newline^#(@y, @lastline', @xs)) , 17: newline#3^#(@nl, @belowVal, @lastline', @x, @y) -> c_31(newline#4^#(right(@nl), @belowVal, @lastline', @nl, @x, @y), right^#(@nl)) , 18: newline#4^#(@rightVal, @belowVal, @lastline', @nl, @x, @y) -> c_33(newline#5^#(right(@lastline'), @belowVal, @nl, @rightVal, @x, @y), right^#(@lastline')) , 19: right^#(@l) -> c_32(right#1^#(@l)) , 20: right#1^#(nil()) -> c_39(#abs^#(#0())) , 21: newline#5^#(@diagVal, @belowVal, @nl, @rightVal, @x, @y) -> c_34(newline#6^#(newline#7(#equal(@x, @y), @belowVal, @diagVal, @rightVal), @nl), newline#7^#(#equal(@x, @y), @belowVal, @diagVal, @rightVal), #equal^#(@x, @y)) , 22: newline#7^#(#false(), @belowVal, @diagVal, @rightVal) -> c_35(max^#(@belowVal, @rightVal)) , 23: newline#7^#(#true(), @belowVal, @diagVal, @rightVal) -> c_36(+^#(@diagVal, #pos(#s(#0())))) , 24: #abs^#(#0()) -> c_1() , 25: #equal^#(@x, @y) -> c_5(#eq^#(@x, @y)) , 26: #eq^#(#0(), #0()) -> c_40() , 27: #eq^#(#0(), #neg(@y)) -> c_41() , 28: #eq^#(#0(), #pos(@y)) -> c_42() , 29: #eq^#(#0(), #s(@y)) -> c_43() , 30: #eq^#(#neg(@x), #0()) -> c_44() , 31: #eq^#(#neg(@x), #neg(@y)) -> c_45(#eq^#(@x, @y)) , 32: #eq^#(#neg(@x), #pos(@y)) -> c_46() , 33: #eq^#(#pos(@x), #0()) -> c_47() , 34: #eq^#(#pos(@x), #neg(@y)) -> c_48() , 35: #eq^#(#pos(@x), #pos(@y)) -> c_49(#eq^#(@x, @y)) , 36: #eq^#(#s(@x), #0()) -> c_50() , 37: #eq^#(#s(@x), #s(@y)) -> c_51(#eq^#(@x, @y)) , 38: #eq^#(::(@x_1, @x_2), ::(@y_1, @y_2)) -> c_52(#and^#(#eq(@x_1, @y_1), #eq(@x_2, @y_2)), #eq^#(@x_1, @y_1), #eq^#(@x_2, @y_2)) , 39: #eq^#(::(@x_1, @x_2), nil()) -> c_53() , 40: #eq^#(nil(), ::(@y_1, @y_2)) -> c_54() , 41: #eq^#(nil(), nil()) -> c_55() , 42: #greater^#(@x, @y) -> c_6(#ckgt^#(#compare(@x, @y)), #compare^#(@x, @y)) , 43: #ckgt^#(#EQ()) -> c_68() , 44: #ckgt^#(#GT()) -> c_69() , 45: #ckgt^#(#LT()) -> c_70() , 46: #compare^#(#0(), #0()) -> c_56() , 47: #compare^#(#0(), #neg(@y)) -> c_57() , 48: #compare^#(#0(), #pos(@y)) -> c_58() , 49: #compare^#(#0(), #s(@y)) -> c_59() , 50: #compare^#(#neg(@x), #0()) -> c_60() , 51: #compare^#(#neg(@x), #neg(@y)) -> c_61(#compare^#(@y, @x)) , 52: #compare^#(#neg(@x), #pos(@y)) -> c_62() , 53: #compare^#(#pos(@x), #0()) -> c_63() , 54: #compare^#(#pos(@x), #neg(@y)) -> c_64() , 55: #compare^#(#pos(@x), #pos(@y)) -> c_65(#compare^#(@x, @y)) , 56: #compare^#(#s(@x), #0()) -> c_66() , 57: #compare^#(#s(@x), #s(@y)) -> c_67(#compare^#(@x, @y)) , 58: +^#(@x, @y) -> c_7(#add^#(@x, @y)) , 59: #add^#(#0(), @y) -> c_71() , 60: #add^#(#neg(#s(#0())), @y) -> c_72(#pred^#(@y)) , 61: #add^#(#neg(#s(#s(@x))), @y) -> c_73(#pred^#(#add(#pos(#s(@x)), @y)), #add^#(#pos(#s(@x)), @y)) , 62: #add^#(#pos(#s(#0())), @y) -> c_74(#succ^#(@y)) , 63: #add^#(#pos(#s(#s(@x))), @y) -> c_75(#succ^#(#add(#pos(#s(@x)), @y)), #add^#(#pos(#s(@x)), @y)) , 64: firstline#1^#(nil()) -> c_10() , 65: lcs#3^#(::(@len, @_@1)) -> c_16() , 66: lcstable#3^#(nil(), @l2, @x) -> c_22() , 67: newline#1^#(nil(), @lastline, @y) -> c_28() , 68: max#1^#(#false(), @a, @b) -> c_25() , 69: max#1^#(#true(), @a, @b) -> c_26() , 70: newline#2^#(nil(), @x, @xs, @y) -> c_30() , 71: right#1^#(::(@x, @xs)) -> c_38() , 72: newline#6^#(@elem, @nl) -> c_37() , 73: #and^#(#false(), #false()) -> c_84() , 74: #and^#(#false(), #true()) -> c_85() , 75: #and^#(#true(), #false()) -> c_86() , 76: #and^#(#true(), #true()) -> c_87() , 77: #pred^#(#0()) -> c_76() , 78: #pred^#(#neg(#s(@x))) -> c_77() , 79: #pred^#(#pos(#s(#0()))) -> c_78() , 80: #pred^#(#pos(#s(#s(@x)))) -> c_79() , 81: #succ^#(#0()) -> c_80() , 82: #succ^#(#neg(#s(#0()))) -> c_81() , 83: #succ^#(#neg(#s(#s(@x)))) -> c_82() , 84: #succ^#(#pos(#s(@x))) -> c_83() } We are left with following problem, upon which TcT provides the certificate YES(O(1),O(n^2)). Strict DPs: { firstline^#(@l) -> c_8(firstline#1^#(@l)) , firstline#1^#(::(@x, @xs)) -> c_9(#abs^#(#0()), firstline^#(@xs)) , lcs^#(@l1, @l2) -> c_11(lcs#1^#(lcstable(@l1, @l2)), lcstable^#(@l1, @l2)) , lcs#1^#(@m) -> c_13(lcs#2^#(@m)) , lcstable^#(@l1, @l2) -> c_12(lcstable#1^#(@l1, @l2)) , lcstable#1^#(::(@x, @xs), @l2) -> c_18(lcstable#2^#(lcstable(@xs, @l2), @l2, @x), lcstable^#(@xs, @l2)) , lcstable#1^#(nil(), @l2) -> c_19(firstline^#(@l2)) , lcs#2^#(::(@l1, @_@2)) -> c_14(lcs#3^#(@l1)) , lcstable#2^#(@m, @l2, @x) -> c_20(lcstable#3^#(@m, @l2, @x)) , lcstable#3^#(::(@l, @ls), @l2, @x) -> c_21(newline^#(@x, @l, @l2)) , newline^#(@y, @lastline, @l) -> c_23(newline#1^#(@l, @lastline, @y)) , newline#1^#(::(@x, @xs), @lastline, @y) -> c_27(newline#2^#(@lastline, @x, @xs, @y)) , newline#2^#(::(@belowVal, @lastline'), @x, @xs, @y) -> c_29(newline#3^#(newline(@y, @lastline', @xs), @belowVal, @lastline', @x, @y), newline^#(@y, @lastline', @xs)) , newline#3^#(@nl, @belowVal, @lastline', @x, @y) -> c_31(newline#4^#(right(@nl), @belowVal, @lastline', @nl, @x, @y), right^#(@nl)) , newline#4^#(@rightVal, @belowVal, @lastline', @nl, @x, @y) -> c_33(newline#5^#(right(@lastline'), @belowVal, @nl, @rightVal, @x, @y), right^#(@lastline')) , right^#(@l) -> c_32(right#1^#(@l)) , newline#5^#(@diagVal, @belowVal, @nl, @rightVal, @x, @y) -> c_34(newline#6^#(newline#7(#equal(@x, @y), @belowVal, @diagVal, @rightVal), @nl), newline#7^#(#equal(@x, @y), @belowVal, @diagVal, @rightVal), #equal^#(@x, @y)) , newline#7^#(#false(), @belowVal, @diagVal, @rightVal) -> c_35(max^#(@belowVal, @rightVal)) } Weak DPs: { #abs^#(#0()) -> c_1() , #equal^#(@x, @y) -> c_5(#eq^#(@x, @y)) , #eq^#(#0(), #0()) -> c_40() , #eq^#(#0(), #neg(@y)) -> c_41() , #eq^#(#0(), #pos(@y)) -> c_42() , #eq^#(#0(), #s(@y)) -> c_43() , #eq^#(#neg(@x), #0()) -> c_44() , #eq^#(#neg(@x), #neg(@y)) -> c_45(#eq^#(@x, @y)) , #eq^#(#neg(@x), #pos(@y)) -> c_46() , #eq^#(#pos(@x), #0()) -> c_47() , #eq^#(#pos(@x), #neg(@y)) -> c_48() , #eq^#(#pos(@x), #pos(@y)) -> c_49(#eq^#(@x, @y)) , #eq^#(#s(@x), #0()) -> c_50() , #eq^#(#s(@x), #s(@y)) -> c_51(#eq^#(@x, @y)) , #eq^#(::(@x_1, @x_2), ::(@y_1, @y_2)) -> c_52(#and^#(#eq(@x_1, @y_1), #eq(@x_2, @y_2)), #eq^#(@x_1, @y_1), #eq^#(@x_2, @y_2)) , #eq^#(::(@x_1, @x_2), nil()) -> c_53() , #eq^#(nil(), ::(@y_1, @y_2)) -> c_54() , #eq^#(nil(), nil()) -> c_55() , #greater^#(@x, @y) -> c_6(#ckgt^#(#compare(@x, @y)), #compare^#(@x, @y)) , #ckgt^#(#EQ()) -> c_68() , #ckgt^#(#GT()) -> c_69() , #ckgt^#(#LT()) -> c_70() , #compare^#(#0(), #0()) -> c_56() , #compare^#(#0(), #neg(@y)) -> c_57() , #compare^#(#0(), #pos(@y)) -> c_58() , #compare^#(#0(), #s(@y)) -> c_59() , #compare^#(#neg(@x), #0()) -> c_60() , #compare^#(#neg(@x), #neg(@y)) -> c_61(#compare^#(@y, @x)) , #compare^#(#neg(@x), #pos(@y)) -> c_62() , #compare^#(#pos(@x), #0()) -> c_63() , #compare^#(#pos(@x), #neg(@y)) -> c_64() , #compare^#(#pos(@x), #pos(@y)) -> c_65(#compare^#(@x, @y)) , #compare^#(#s(@x), #0()) -> c_66() , #compare^#(#s(@x), #s(@y)) -> c_67(#compare^#(@x, @y)) , +^#(@x, @y) -> c_7(#add^#(@x, @y)) , #add^#(#0(), @y) -> c_71() , #add^#(#neg(#s(#0())), @y) -> c_72(#pred^#(@y)) , #add^#(#neg(#s(#s(@x))), @y) -> c_73(#pred^#(#add(#pos(#s(@x)), @y)), #add^#(#pos(#s(@x)), @y)) , #add^#(#pos(#s(#0())), @y) -> c_74(#succ^#(@y)) , #add^#(#pos(#s(#s(@x))), @y) -> c_75(#succ^#(#add(#pos(#s(@x)), @y)), #add^#(#pos(#s(@x)), @y)) , firstline#1^#(nil()) -> c_10() , lcs#2^#(nil()) -> c_15(#abs^#(#0())) , lcs#3^#(::(@len, @_@1)) -> c_16() , lcs#3^#(nil()) -> c_17(#abs^#(#0())) , lcstable#3^#(nil(), @l2, @x) -> c_22() , newline#1^#(nil(), @lastline, @y) -> c_28() , max^#(@a, @b) -> c_24(max#1^#(#greater(@a, @b), @a, @b), #greater^#(@a, @b)) , max#1^#(#false(), @a, @b) -> c_25() , max#1^#(#true(), @a, @b) -> c_26() , newline#2^#(nil(), @x, @xs, @y) -> c_30() , right#1^#(::(@x, @xs)) -> c_38() , right#1^#(nil()) -> c_39(#abs^#(#0())) , newline#6^#(@elem, @nl) -> c_37() , newline#7^#(#true(), @belowVal, @diagVal, @rightVal) -> c_36(+^#(@diagVal, #pos(#s(#0())))) , #and^#(#false(), #false()) -> c_84() , #and^#(#false(), #true()) -> c_85() , #and^#(#true(), #false()) -> c_86() , #and^#(#true(), #true()) -> c_87() , #pred^#(#0()) -> c_76() , #pred^#(#neg(#s(@x))) -> c_77() , #pred^#(#pos(#s(#0()))) -> c_78() , #pred^#(#pos(#s(#s(@x)))) -> c_79() , #succ^#(#0()) -> c_80() , #succ^#(#neg(#s(#0()))) -> c_81() , #succ^#(#neg(#s(#s(@x)))) -> c_82() , #succ^#(#pos(#s(@x))) -> c_83() } Weak Trs: { #abs(#0()) -> #0() , #abs(#neg(@x)) -> #pos(@x) , #abs(#pos(@x)) -> #pos(@x) , #abs(#s(@x)) -> #pos(#s(@x)) , #equal(@x, @y) -> #eq(@x, @y) , #eq(#0(), #0()) -> #true() , #eq(#0(), #neg(@y)) -> #false() , #eq(#0(), #pos(@y)) -> #false() , #eq(#0(), #s(@y)) -> #false() , #eq(#neg(@x), #0()) -> #false() , #eq(#neg(@x), #neg(@y)) -> #eq(@x, @y) , #eq(#neg(@x), #pos(@y)) -> #false() , #eq(#pos(@x), #0()) -> #false() , #eq(#pos(@x), #neg(@y)) -> #false() , #eq(#pos(@x), #pos(@y)) -> #eq(@x, @y) , #eq(#s(@x), #0()) -> #false() , #eq(#s(@x), #s(@y)) -> #eq(@x, @y) , #eq(::(@x_1, @x_2), ::(@y_1, @y_2)) -> #and(#eq(@x_1, @y_1), #eq(@x_2, @y_2)) , #eq(::(@x_1, @x_2), nil()) -> #false() , #eq(nil(), ::(@y_1, @y_2)) -> #false() , #eq(nil(), nil()) -> #true() , #greater(@x, @y) -> #ckgt(#compare(@x, @y)) , #compare(#0(), #0()) -> #EQ() , #compare(#0(), #neg(@y)) -> #GT() , #compare(#0(), #pos(@y)) -> #LT() , #compare(#0(), #s(@y)) -> #LT() , #compare(#neg(@x), #0()) -> #LT() , #compare(#neg(@x), #neg(@y)) -> #compare(@y, @x) , #compare(#neg(@x), #pos(@y)) -> #LT() , #compare(#pos(@x), #0()) -> #GT() , #compare(#pos(@x), #neg(@y)) -> #GT() , #compare(#pos(@x), #pos(@y)) -> #compare(@x, @y) , #compare(#s(@x), #0()) -> #GT() , #compare(#s(@x), #s(@y)) -> #compare(@x, @y) , #ckgt(#EQ()) -> #false() , #ckgt(#GT()) -> #true() , #ckgt(#LT()) -> #false() , +(@x, @y) -> #add(@x, @y) , #add(#0(), @y) -> @y , #add(#neg(#s(#0())), @y) -> #pred(@y) , #add(#neg(#s(#s(@x))), @y) -> #pred(#add(#pos(#s(@x)), @y)) , #add(#pos(#s(#0())), @y) -> #succ(@y) , #add(#pos(#s(#s(@x))), @y) -> #succ(#add(#pos(#s(@x)), @y)) , firstline(@l) -> firstline#1(@l) , firstline#1(::(@x, @xs)) -> ::(#abs(#0()), firstline(@xs)) , firstline#1(nil()) -> nil() , lcs(@l1, @l2) -> lcs#1(lcstable(@l1, @l2)) , lcstable(@l1, @l2) -> lcstable#1(@l1, @l2) , lcs#1(@m) -> lcs#2(@m) , lcs#2(::(@l1, @_@2)) -> lcs#3(@l1) , lcs#2(nil()) -> #abs(#0()) , lcs#3(::(@len, @_@1)) -> @len , lcs#3(nil()) -> #abs(#0()) , lcstable#1(::(@x, @xs), @l2) -> lcstable#2(lcstable(@xs, @l2), @l2, @x) , lcstable#1(nil(), @l2) -> ::(firstline(@l2), nil()) , lcstable#2(@m, @l2, @x) -> lcstable#3(@m, @l2, @x) , lcstable#3(::(@l, @ls), @l2, @x) -> ::(newline(@x, @l, @l2), ::(@l, @ls)) , lcstable#3(nil(), @l2, @x) -> nil() , newline(@y, @lastline, @l) -> newline#1(@l, @lastline, @y) , max(@a, @b) -> max#1(#greater(@a, @b), @a, @b) , max#1(#false(), @a, @b) -> @b , max#1(#true(), @a, @b) -> @a , newline#1(::(@x, @xs), @lastline, @y) -> newline#2(@lastline, @x, @xs, @y) , newline#1(nil(), @lastline, @y) -> nil() , newline#2(::(@belowVal, @lastline'), @x, @xs, @y) -> newline#3(newline(@y, @lastline', @xs), @belowVal, @lastline', @x, @y) , newline#2(nil(), @x, @xs, @y) -> nil() , newline#3(@nl, @belowVal, @lastline', @x, @y) -> newline#4(right(@nl), @belowVal, @lastline', @nl, @x, @y) , right(@l) -> right#1(@l) , newline#4(@rightVal, @belowVal, @lastline', @nl, @x, @y) -> newline#5(right(@lastline'), @belowVal, @nl, @rightVal, @x, @y) , newline#5(@diagVal, @belowVal, @nl, @rightVal, @x, @y) -> newline#6(newline#7(#equal(@x, @y), @belowVal, @diagVal, @rightVal), @nl) , newline#7(#false(), @belowVal, @diagVal, @rightVal) -> max(@belowVal, @rightVal) , newline#7(#true(), @belowVal, @diagVal, @rightVal) -> +(@diagVal, #pos(#s(#0()))) , newline#6(@elem, @nl) -> ::(@elem, @nl) , right#1(::(@x, @xs)) -> @x , right#1(nil()) -> #abs(#0()) , #pred(#0()) -> #neg(#s(#0())) , #pred(#neg(#s(@x))) -> #neg(#s(#s(@x))) , #pred(#pos(#s(#0()))) -> #0() , #pred(#pos(#s(#s(@x)))) -> #pos(#s(@x)) , #succ(#0()) -> #pos(#s(#0())) , #succ(#neg(#s(#0()))) -> #0() , #succ(#neg(#s(#s(@x)))) -> #neg(#s(@x)) , #succ(#pos(#s(@x))) -> #pos(#s(#s(@x))) , #and(#false(), #false()) -> #false() , #and(#false(), #true()) -> #false() , #and(#true(), #false()) -> #false() , #and(#true(), #true()) -> #true() } Obligation: innermost runtime complexity Answer: YES(O(1),O(n^2)) We estimate the number of application of {8,16,18} by applications of Pre({8,16,18}) = {4,14,15,17}. Here rules are labeled as follows: DPs: { 1: firstline^#(@l) -> c_8(firstline#1^#(@l)) , 2: firstline#1^#(::(@x, @xs)) -> c_9(#abs^#(#0()), firstline^#(@xs)) , 3: lcs^#(@l1, @l2) -> c_11(lcs#1^#(lcstable(@l1, @l2)), lcstable^#(@l1, @l2)) , 4: lcs#1^#(@m) -> c_13(lcs#2^#(@m)) , 5: lcstable^#(@l1, @l2) -> c_12(lcstable#1^#(@l1, @l2)) , 6: lcstable#1^#(::(@x, @xs), @l2) -> c_18(lcstable#2^#(lcstable(@xs, @l2), @l2, @x), lcstable^#(@xs, @l2)) , 7: lcstable#1^#(nil(), @l2) -> c_19(firstline^#(@l2)) , 8: lcs#2^#(::(@l1, @_@2)) -> c_14(lcs#3^#(@l1)) , 9: lcstable#2^#(@m, @l2, @x) -> c_20(lcstable#3^#(@m, @l2, @x)) , 10: lcstable#3^#(::(@l, @ls), @l2, @x) -> c_21(newline^#(@x, @l, @l2)) , 11: newline^#(@y, @lastline, @l) -> c_23(newline#1^#(@l, @lastline, @y)) , 12: newline#1^#(::(@x, @xs), @lastline, @y) -> c_27(newline#2^#(@lastline, @x, @xs, @y)) , 13: newline#2^#(::(@belowVal, @lastline'), @x, @xs, @y) -> c_29(newline#3^#(newline(@y, @lastline', @xs), @belowVal, @lastline', @x, @y), newline^#(@y, @lastline', @xs)) , 14: newline#3^#(@nl, @belowVal, @lastline', @x, @y) -> c_31(newline#4^#(right(@nl), @belowVal, @lastline', @nl, @x, @y), right^#(@nl)) , 15: newline#4^#(@rightVal, @belowVal, @lastline', @nl, @x, @y) -> c_33(newline#5^#(right(@lastline'), @belowVal, @nl, @rightVal, @x, @y), right^#(@lastline')) , 16: right^#(@l) -> c_32(right#1^#(@l)) , 17: newline#5^#(@diagVal, @belowVal, @nl, @rightVal, @x, @y) -> c_34(newline#6^#(newline#7(#equal(@x, @y), @belowVal, @diagVal, @rightVal), @nl), newline#7^#(#equal(@x, @y), @belowVal, @diagVal, @rightVal), #equal^#(@x, @y)) , 18: newline#7^#(#false(), @belowVal, @diagVal, @rightVal) -> c_35(max^#(@belowVal, @rightVal)) , 19: #abs^#(#0()) -> c_1() , 20: #equal^#(@x, @y) -> c_5(#eq^#(@x, @y)) , 21: #eq^#(#0(), #0()) -> c_40() , 22: #eq^#(#0(), #neg(@y)) -> c_41() , 23: #eq^#(#0(), #pos(@y)) -> c_42() , 24: #eq^#(#0(), #s(@y)) -> c_43() , 25: #eq^#(#neg(@x), #0()) -> c_44() , 26: #eq^#(#neg(@x), #neg(@y)) -> c_45(#eq^#(@x, @y)) , 27: #eq^#(#neg(@x), #pos(@y)) -> c_46() , 28: #eq^#(#pos(@x), #0()) -> c_47() , 29: #eq^#(#pos(@x), #neg(@y)) -> c_48() , 30: #eq^#(#pos(@x), #pos(@y)) -> c_49(#eq^#(@x, @y)) , 31: #eq^#(#s(@x), #0()) -> c_50() , 32: #eq^#(#s(@x), #s(@y)) -> c_51(#eq^#(@x, @y)) , 33: #eq^#(::(@x_1, @x_2), ::(@y_1, @y_2)) -> c_52(#and^#(#eq(@x_1, @y_1), #eq(@x_2, @y_2)), #eq^#(@x_1, @y_1), #eq^#(@x_2, @y_2)) , 34: #eq^#(::(@x_1, @x_2), nil()) -> c_53() , 35: #eq^#(nil(), ::(@y_1, @y_2)) -> c_54() , 36: #eq^#(nil(), nil()) -> c_55() , 37: #greater^#(@x, @y) -> c_6(#ckgt^#(#compare(@x, @y)), #compare^#(@x, @y)) , 38: #ckgt^#(#EQ()) -> c_68() , 39: #ckgt^#(#GT()) -> c_69() , 40: #ckgt^#(#LT()) -> c_70() , 41: #compare^#(#0(), #0()) -> c_56() , 42: #compare^#(#0(), #neg(@y)) -> c_57() , 43: #compare^#(#0(), #pos(@y)) -> c_58() , 44: #compare^#(#0(), #s(@y)) -> c_59() , 45: #compare^#(#neg(@x), #0()) -> c_60() , 46: #compare^#(#neg(@x), #neg(@y)) -> c_61(#compare^#(@y, @x)) , 47: #compare^#(#neg(@x), #pos(@y)) -> c_62() , 48: #compare^#(#pos(@x), #0()) -> c_63() , 49: #compare^#(#pos(@x), #neg(@y)) -> c_64() , 50: #compare^#(#pos(@x), #pos(@y)) -> c_65(#compare^#(@x, @y)) , 51: #compare^#(#s(@x), #0()) -> c_66() , 52: #compare^#(#s(@x), #s(@y)) -> c_67(#compare^#(@x, @y)) , 53: +^#(@x, @y) -> c_7(#add^#(@x, @y)) , 54: #add^#(#0(), @y) -> c_71() , 55: #add^#(#neg(#s(#0())), @y) -> c_72(#pred^#(@y)) , 56: #add^#(#neg(#s(#s(@x))), @y) -> c_73(#pred^#(#add(#pos(#s(@x)), @y)), #add^#(#pos(#s(@x)), @y)) , 57: #add^#(#pos(#s(#0())), @y) -> c_74(#succ^#(@y)) , 58: #add^#(#pos(#s(#s(@x))), @y) -> c_75(#succ^#(#add(#pos(#s(@x)), @y)), #add^#(#pos(#s(@x)), @y)) , 59: firstline#1^#(nil()) -> c_10() , 60: lcs#2^#(nil()) -> c_15(#abs^#(#0())) , 61: lcs#3^#(::(@len, @_@1)) -> c_16() , 62: lcs#3^#(nil()) -> c_17(#abs^#(#0())) , 63: lcstable#3^#(nil(), @l2, @x) -> c_22() , 64: newline#1^#(nil(), @lastline, @y) -> c_28() , 65: max^#(@a, @b) -> c_24(max#1^#(#greater(@a, @b), @a, @b), #greater^#(@a, @b)) , 66: max#1^#(#false(), @a, @b) -> c_25() , 67: max#1^#(#true(), @a, @b) -> c_26() , 68: newline#2^#(nil(), @x, @xs, @y) -> c_30() , 69: right#1^#(::(@x, @xs)) -> c_38() , 70: right#1^#(nil()) -> c_39(#abs^#(#0())) , 71: newline#6^#(@elem, @nl) -> c_37() , 72: newline#7^#(#true(), @belowVal, @diagVal, @rightVal) -> c_36(+^#(@diagVal, #pos(#s(#0())))) , 73: #and^#(#false(), #false()) -> c_84() , 74: #and^#(#false(), #true()) -> c_85() , 75: #and^#(#true(), #false()) -> c_86() , 76: #and^#(#true(), #true()) -> c_87() , 77: #pred^#(#0()) -> c_76() , 78: #pred^#(#neg(#s(@x))) -> c_77() , 79: #pred^#(#pos(#s(#0()))) -> c_78() , 80: #pred^#(#pos(#s(#s(@x)))) -> c_79() , 81: #succ^#(#0()) -> c_80() , 82: #succ^#(#neg(#s(#0()))) -> c_81() , 83: #succ^#(#neg(#s(#s(@x)))) -> c_82() , 84: #succ^#(#pos(#s(@x))) -> c_83() } We are left with following problem, upon which TcT provides the certificate YES(O(1),O(n^2)). Strict DPs: { firstline^#(@l) -> c_8(firstline#1^#(@l)) , firstline#1^#(::(@x, @xs)) -> c_9(#abs^#(#0()), firstline^#(@xs)) , lcs^#(@l1, @l2) -> c_11(lcs#1^#(lcstable(@l1, @l2)), lcstable^#(@l1, @l2)) , lcs#1^#(@m) -> c_13(lcs#2^#(@m)) , lcstable^#(@l1, @l2) -> c_12(lcstable#1^#(@l1, @l2)) , lcstable#1^#(::(@x, @xs), @l2) -> c_18(lcstable#2^#(lcstable(@xs, @l2), @l2, @x), lcstable^#(@xs, @l2)) , lcstable#1^#(nil(), @l2) -> c_19(firstline^#(@l2)) , lcstable#2^#(@m, @l2, @x) -> c_20(lcstable#3^#(@m, @l2, @x)) , lcstable#3^#(::(@l, @ls), @l2, @x) -> c_21(newline^#(@x, @l, @l2)) , newline^#(@y, @lastline, @l) -> c_23(newline#1^#(@l, @lastline, @y)) , newline#1^#(::(@x, @xs), @lastline, @y) -> c_27(newline#2^#(@lastline, @x, @xs, @y)) , newline#2^#(::(@belowVal, @lastline'), @x, @xs, @y) -> c_29(newline#3^#(newline(@y, @lastline', @xs), @belowVal, @lastline', @x, @y), newline^#(@y, @lastline', @xs)) , newline#3^#(@nl, @belowVal, @lastline', @x, @y) -> c_31(newline#4^#(right(@nl), @belowVal, @lastline', @nl, @x, @y), right^#(@nl)) , newline#4^#(@rightVal, @belowVal, @lastline', @nl, @x, @y) -> c_33(newline#5^#(right(@lastline'), @belowVal, @nl, @rightVal, @x, @y), right^#(@lastline')) , newline#5^#(@diagVal, @belowVal, @nl, @rightVal, @x, @y) -> c_34(newline#6^#(newline#7(#equal(@x, @y), @belowVal, @diagVal, @rightVal), @nl), newline#7^#(#equal(@x, @y), @belowVal, @diagVal, @rightVal), #equal^#(@x, @y)) } Weak DPs: { #abs^#(#0()) -> c_1() , #equal^#(@x, @y) -> c_5(#eq^#(@x, @y)) , #eq^#(#0(), #0()) -> c_40() , #eq^#(#0(), #neg(@y)) -> c_41() , #eq^#(#0(), #pos(@y)) -> c_42() , #eq^#(#0(), #s(@y)) -> c_43() , #eq^#(#neg(@x), #0()) -> c_44() , #eq^#(#neg(@x), #neg(@y)) -> c_45(#eq^#(@x, @y)) , #eq^#(#neg(@x), #pos(@y)) -> c_46() , #eq^#(#pos(@x), #0()) -> c_47() , #eq^#(#pos(@x), #neg(@y)) -> c_48() , #eq^#(#pos(@x), #pos(@y)) -> c_49(#eq^#(@x, @y)) , #eq^#(#s(@x), #0()) -> c_50() , #eq^#(#s(@x), #s(@y)) -> c_51(#eq^#(@x, @y)) , #eq^#(::(@x_1, @x_2), ::(@y_1, @y_2)) -> c_52(#and^#(#eq(@x_1, @y_1), #eq(@x_2, @y_2)), #eq^#(@x_1, @y_1), #eq^#(@x_2, @y_2)) , #eq^#(::(@x_1, @x_2), nil()) -> c_53() , #eq^#(nil(), ::(@y_1, @y_2)) -> c_54() , #eq^#(nil(), nil()) -> c_55() , #greater^#(@x, @y) -> c_6(#ckgt^#(#compare(@x, @y)), #compare^#(@x, @y)) , #ckgt^#(#EQ()) -> c_68() , #ckgt^#(#GT()) -> c_69() , #ckgt^#(#LT()) -> c_70() , #compare^#(#0(), #0()) -> c_56() , #compare^#(#0(), #neg(@y)) -> c_57() , #compare^#(#0(), #pos(@y)) -> c_58() , #compare^#(#0(), #s(@y)) -> c_59() , #compare^#(#neg(@x), #0()) -> c_60() , #compare^#(#neg(@x), #neg(@y)) -> c_61(#compare^#(@y, @x)) , #compare^#(#neg(@x), #pos(@y)) -> c_62() , #compare^#(#pos(@x), #0()) -> c_63() , #compare^#(#pos(@x), #neg(@y)) -> c_64() , #compare^#(#pos(@x), #pos(@y)) -> c_65(#compare^#(@x, @y)) , #compare^#(#s(@x), #0()) -> c_66() , #compare^#(#s(@x), #s(@y)) -> c_67(#compare^#(@x, @y)) , +^#(@x, @y) -> c_7(#add^#(@x, @y)) , #add^#(#0(), @y) -> c_71() , #add^#(#neg(#s(#0())), @y) -> c_72(#pred^#(@y)) , #add^#(#neg(#s(#s(@x))), @y) -> c_73(#pred^#(#add(#pos(#s(@x)), @y)), #add^#(#pos(#s(@x)), @y)) , #add^#(#pos(#s(#0())), @y) -> c_74(#succ^#(@y)) , #add^#(#pos(#s(#s(@x))), @y) -> c_75(#succ^#(#add(#pos(#s(@x)), @y)), #add^#(#pos(#s(@x)), @y)) , firstline#1^#(nil()) -> c_10() , lcs#2^#(::(@l1, @_@2)) -> c_14(lcs#3^#(@l1)) , lcs#2^#(nil()) -> c_15(#abs^#(#0())) , lcs#3^#(::(@len, @_@1)) -> c_16() , lcs#3^#(nil()) -> c_17(#abs^#(#0())) , lcstable#3^#(nil(), @l2, @x) -> c_22() , newline#1^#(nil(), @lastline, @y) -> c_28() , max^#(@a, @b) -> c_24(max#1^#(#greater(@a, @b), @a, @b), #greater^#(@a, @b)) , max#1^#(#false(), @a, @b) -> c_25() , max#1^#(#true(), @a, @b) -> c_26() , newline#2^#(nil(), @x, @xs, @y) -> c_30() , right^#(@l) -> c_32(right#1^#(@l)) , right#1^#(::(@x, @xs)) -> c_38() , right#1^#(nil()) -> c_39(#abs^#(#0())) , newline#6^#(@elem, @nl) -> c_37() , newline#7^#(#false(), @belowVal, @diagVal, @rightVal) -> c_35(max^#(@belowVal, @rightVal)) , newline#7^#(#true(), @belowVal, @diagVal, @rightVal) -> c_36(+^#(@diagVal, #pos(#s(#0())))) , #and^#(#false(), #false()) -> c_84() , #and^#(#false(), #true()) -> c_85() , #and^#(#true(), #false()) -> c_86() , #and^#(#true(), #true()) -> c_87() , #pred^#(#0()) -> c_76() , #pred^#(#neg(#s(@x))) -> c_77() , #pred^#(#pos(#s(#0()))) -> c_78() , #pred^#(#pos(#s(#s(@x)))) -> c_79() , #succ^#(#0()) -> c_80() , #succ^#(#neg(#s(#0()))) -> c_81() , #succ^#(#neg(#s(#s(@x)))) -> c_82() , #succ^#(#pos(#s(@x))) -> c_83() } Weak Trs: { #abs(#0()) -> #0() , #abs(#neg(@x)) -> #pos(@x) , #abs(#pos(@x)) -> #pos(@x) , #abs(#s(@x)) -> #pos(#s(@x)) , #equal(@x, @y) -> #eq(@x, @y) , #eq(#0(), #0()) -> #true() , #eq(#0(), #neg(@y)) -> #false() , #eq(#0(), #pos(@y)) -> #false() , #eq(#0(), #s(@y)) -> #false() , #eq(#neg(@x), #0()) -> #false() , #eq(#neg(@x), #neg(@y)) -> #eq(@x, @y) , #eq(#neg(@x), #pos(@y)) -> #false() , #eq(#pos(@x), #0()) -> #false() , #eq(#pos(@x), #neg(@y)) -> #false() , #eq(#pos(@x), #pos(@y)) -> #eq(@x, @y) , #eq(#s(@x), #0()) -> #false() , #eq(#s(@x), #s(@y)) -> #eq(@x, @y) , #eq(::(@x_1, @x_2), ::(@y_1, @y_2)) -> #and(#eq(@x_1, @y_1), #eq(@x_2, @y_2)) , #eq(::(@x_1, @x_2), nil()) -> #false() , #eq(nil(), ::(@y_1, @y_2)) -> #false() , #eq(nil(), nil()) -> #true() , #greater(@x, @y) -> #ckgt(#compare(@x, @y)) , #compare(#0(), #0()) -> #EQ() , #compare(#0(), #neg(@y)) -> #GT() , #compare(#0(), #pos(@y)) -> #LT() , #compare(#0(), #s(@y)) -> #LT() , #compare(#neg(@x), #0()) -> #LT() , #compare(#neg(@x), #neg(@y)) -> #compare(@y, @x) , #compare(#neg(@x), #pos(@y)) -> #LT() , #compare(#pos(@x), #0()) -> #GT() , #compare(#pos(@x), #neg(@y)) -> #GT() , #compare(#pos(@x), #pos(@y)) -> #compare(@x, @y) , #compare(#s(@x), #0()) -> #GT() , #compare(#s(@x), #s(@y)) -> #compare(@x, @y) , #ckgt(#EQ()) -> #false() , #ckgt(#GT()) -> #true() , #ckgt(#LT()) -> #false() , +(@x, @y) -> #add(@x, @y) , #add(#0(), @y) -> @y , #add(#neg(#s(#0())), @y) -> #pred(@y) , #add(#neg(#s(#s(@x))), @y) -> #pred(#add(#pos(#s(@x)), @y)) , #add(#pos(#s(#0())), @y) -> #succ(@y) , #add(#pos(#s(#s(@x))), @y) -> #succ(#add(#pos(#s(@x)), @y)) , firstline(@l) -> firstline#1(@l) , firstline#1(::(@x, @xs)) -> ::(#abs(#0()), firstline(@xs)) , firstline#1(nil()) -> nil() , lcs(@l1, @l2) -> lcs#1(lcstable(@l1, @l2)) , lcstable(@l1, @l2) -> lcstable#1(@l1, @l2) , lcs#1(@m) -> lcs#2(@m) , lcs#2(::(@l1, @_@2)) -> lcs#3(@l1) , lcs#2(nil()) -> #abs(#0()) , lcs#3(::(@len, @_@1)) -> @len , lcs#3(nil()) -> #abs(#0()) , lcstable#1(::(@x, @xs), @l2) -> lcstable#2(lcstable(@xs, @l2), @l2, @x) , lcstable#1(nil(), @l2) -> ::(firstline(@l2), nil()) , lcstable#2(@m, @l2, @x) -> lcstable#3(@m, @l2, @x) , lcstable#3(::(@l, @ls), @l2, @x) -> ::(newline(@x, @l, @l2), ::(@l, @ls)) , lcstable#3(nil(), @l2, @x) -> nil() , newline(@y, @lastline, @l) -> newline#1(@l, @lastline, @y) , max(@a, @b) -> max#1(#greater(@a, @b), @a, @b) , max#1(#false(), @a, @b) -> @b , max#1(#true(), @a, @b) -> @a , newline#1(::(@x, @xs), @lastline, @y) -> newline#2(@lastline, @x, @xs, @y) , newline#1(nil(), @lastline, @y) -> nil() , newline#2(::(@belowVal, @lastline'), @x, @xs, @y) -> newline#3(newline(@y, @lastline', @xs), @belowVal, @lastline', @x, @y) , newline#2(nil(), @x, @xs, @y) -> nil() , newline#3(@nl, @belowVal, @lastline', @x, @y) -> newline#4(right(@nl), @belowVal, @lastline', @nl, @x, @y) , right(@l) -> right#1(@l) , newline#4(@rightVal, @belowVal, @lastline', @nl, @x, @y) -> newline#5(right(@lastline'), @belowVal, @nl, @rightVal, @x, @y) , newline#5(@diagVal, @belowVal, @nl, @rightVal, @x, @y) -> newline#6(newline#7(#equal(@x, @y), @belowVal, @diagVal, @rightVal), @nl) , newline#7(#false(), @belowVal, @diagVal, @rightVal) -> max(@belowVal, @rightVal) , newline#7(#true(), @belowVal, @diagVal, @rightVal) -> +(@diagVal, #pos(#s(#0()))) , newline#6(@elem, @nl) -> ::(@elem, @nl) , right#1(::(@x, @xs)) -> @x , right#1(nil()) -> #abs(#0()) , #pred(#0()) -> #neg(#s(#0())) , #pred(#neg(#s(@x))) -> #neg(#s(#s(@x))) , #pred(#pos(#s(#0()))) -> #0() , #pred(#pos(#s(#s(@x)))) -> #pos(#s(@x)) , #succ(#0()) -> #pos(#s(#0())) , #succ(#neg(#s(#0()))) -> #0() , #succ(#neg(#s(#s(@x)))) -> #neg(#s(@x)) , #succ(#pos(#s(@x))) -> #pos(#s(#s(@x))) , #and(#false(), #false()) -> #false() , #and(#false(), #true()) -> #false() , #and(#true(), #false()) -> #false() , #and(#true(), #true()) -> #true() } Obligation: innermost runtime complexity Answer: YES(O(1),O(n^2)) We estimate the number of application of {4,15} by applications of Pre({4,15}) = {3,14}. Here rules are labeled as follows: DPs: { 1: firstline^#(@l) -> c_8(firstline#1^#(@l)) , 2: firstline#1^#(::(@x, @xs)) -> c_9(#abs^#(#0()), firstline^#(@xs)) , 3: lcs^#(@l1, @l2) -> c_11(lcs#1^#(lcstable(@l1, @l2)), lcstable^#(@l1, @l2)) , 4: lcs#1^#(@m) -> c_13(lcs#2^#(@m)) , 5: lcstable^#(@l1, @l2) -> c_12(lcstable#1^#(@l1, @l2)) , 6: lcstable#1^#(::(@x, @xs), @l2) -> c_18(lcstable#2^#(lcstable(@xs, @l2), @l2, @x), lcstable^#(@xs, @l2)) , 7: lcstable#1^#(nil(), @l2) -> c_19(firstline^#(@l2)) , 8: lcstable#2^#(@m, @l2, @x) -> c_20(lcstable#3^#(@m, @l2, @x)) , 9: lcstable#3^#(::(@l, @ls), @l2, @x) -> c_21(newline^#(@x, @l, @l2)) , 10: newline^#(@y, @lastline, @l) -> c_23(newline#1^#(@l, @lastline, @y)) , 11: newline#1^#(::(@x, @xs), @lastline, @y) -> c_27(newline#2^#(@lastline, @x, @xs, @y)) , 12: newline#2^#(::(@belowVal, @lastline'), @x, @xs, @y) -> c_29(newline#3^#(newline(@y, @lastline', @xs), @belowVal, @lastline', @x, @y), newline^#(@y, @lastline', @xs)) , 13: newline#3^#(@nl, @belowVal, @lastline', @x, @y) -> c_31(newline#4^#(right(@nl), @belowVal, @lastline', @nl, @x, @y), right^#(@nl)) , 14: newline#4^#(@rightVal, @belowVal, @lastline', @nl, @x, @y) -> c_33(newline#5^#(right(@lastline'), @belowVal, @nl, @rightVal, @x, @y), right^#(@lastline')) , 15: newline#5^#(@diagVal, @belowVal, @nl, @rightVal, @x, @y) -> c_34(newline#6^#(newline#7(#equal(@x, @y), @belowVal, @diagVal, @rightVal), @nl), newline#7^#(#equal(@x, @y), @belowVal, @diagVal, @rightVal), #equal^#(@x, @y)) , 16: #abs^#(#0()) -> c_1() , 17: #equal^#(@x, @y) -> c_5(#eq^#(@x, @y)) , 18: #eq^#(#0(), #0()) -> c_40() , 19: #eq^#(#0(), #neg(@y)) -> c_41() , 20: #eq^#(#0(), #pos(@y)) -> c_42() , 21: #eq^#(#0(), #s(@y)) -> c_43() , 22: #eq^#(#neg(@x), #0()) -> c_44() , 23: #eq^#(#neg(@x), #neg(@y)) -> c_45(#eq^#(@x, @y)) , 24: #eq^#(#neg(@x), #pos(@y)) -> c_46() , 25: #eq^#(#pos(@x), #0()) -> c_47() , 26: #eq^#(#pos(@x), #neg(@y)) -> c_48() , 27: #eq^#(#pos(@x), #pos(@y)) -> c_49(#eq^#(@x, @y)) , 28: #eq^#(#s(@x), #0()) -> c_50() , 29: #eq^#(#s(@x), #s(@y)) -> c_51(#eq^#(@x, @y)) , 30: #eq^#(::(@x_1, @x_2), ::(@y_1, @y_2)) -> c_52(#and^#(#eq(@x_1, @y_1), #eq(@x_2, @y_2)), #eq^#(@x_1, @y_1), #eq^#(@x_2, @y_2)) , 31: #eq^#(::(@x_1, @x_2), nil()) -> c_53() , 32: #eq^#(nil(), ::(@y_1, @y_2)) -> c_54() , 33: #eq^#(nil(), nil()) -> c_55() , 34: #greater^#(@x, @y) -> c_6(#ckgt^#(#compare(@x, @y)), #compare^#(@x, @y)) , 35: #ckgt^#(#EQ()) -> c_68() , 36: #ckgt^#(#GT()) -> c_69() , 37: #ckgt^#(#LT()) -> c_70() , 38: #compare^#(#0(), #0()) -> c_56() , 39: #compare^#(#0(), #neg(@y)) -> c_57() , 40: #compare^#(#0(), #pos(@y)) -> c_58() , 41: #compare^#(#0(), #s(@y)) -> c_59() , 42: #compare^#(#neg(@x), #0()) -> c_60() , 43: #compare^#(#neg(@x), #neg(@y)) -> c_61(#compare^#(@y, @x)) , 44: #compare^#(#neg(@x), #pos(@y)) -> c_62() , 45: #compare^#(#pos(@x), #0()) -> c_63() , 46: #compare^#(#pos(@x), #neg(@y)) -> c_64() , 47: #compare^#(#pos(@x), #pos(@y)) -> c_65(#compare^#(@x, @y)) , 48: #compare^#(#s(@x), #0()) -> c_66() , 49: #compare^#(#s(@x), #s(@y)) -> c_67(#compare^#(@x, @y)) , 50: +^#(@x, @y) -> c_7(#add^#(@x, @y)) , 51: #add^#(#0(), @y) -> c_71() , 52: #add^#(#neg(#s(#0())), @y) -> c_72(#pred^#(@y)) , 53: #add^#(#neg(#s(#s(@x))), @y) -> c_73(#pred^#(#add(#pos(#s(@x)), @y)), #add^#(#pos(#s(@x)), @y)) , 54: #add^#(#pos(#s(#0())), @y) -> c_74(#succ^#(@y)) , 55: #add^#(#pos(#s(#s(@x))), @y) -> c_75(#succ^#(#add(#pos(#s(@x)), @y)), #add^#(#pos(#s(@x)), @y)) , 56: firstline#1^#(nil()) -> c_10() , 57: lcs#2^#(::(@l1, @_@2)) -> c_14(lcs#3^#(@l1)) , 58: lcs#2^#(nil()) -> c_15(#abs^#(#0())) , 59: lcs#3^#(::(@len, @_@1)) -> c_16() , 60: lcs#3^#(nil()) -> c_17(#abs^#(#0())) , 61: lcstable#3^#(nil(), @l2, @x) -> c_22() , 62: newline#1^#(nil(), @lastline, @y) -> c_28() , 63: max^#(@a, @b) -> c_24(max#1^#(#greater(@a, @b), @a, @b), #greater^#(@a, @b)) , 64: max#1^#(#false(), @a, @b) -> c_25() , 65: max#1^#(#true(), @a, @b) -> c_26() , 66: newline#2^#(nil(), @x, @xs, @y) -> c_30() , 67: right^#(@l) -> c_32(right#1^#(@l)) , 68: right#1^#(::(@x, @xs)) -> c_38() , 69: right#1^#(nil()) -> c_39(#abs^#(#0())) , 70: newline#6^#(@elem, @nl) -> c_37() , 71: newline#7^#(#false(), @belowVal, @diagVal, @rightVal) -> c_35(max^#(@belowVal, @rightVal)) , 72: newline#7^#(#true(), @belowVal, @diagVal, @rightVal) -> c_36(+^#(@diagVal, #pos(#s(#0())))) , 73: #and^#(#false(), #false()) -> c_84() , 74: #and^#(#false(), #true()) -> c_85() , 75: #and^#(#true(), #false()) -> c_86() , 76: #and^#(#true(), #true()) -> c_87() , 77: #pred^#(#0()) -> c_76() , 78: #pred^#(#neg(#s(@x))) -> c_77() , 79: #pred^#(#pos(#s(#0()))) -> c_78() , 80: #pred^#(#pos(#s(#s(@x)))) -> c_79() , 81: #succ^#(#0()) -> c_80() , 82: #succ^#(#neg(#s(#0()))) -> c_81() , 83: #succ^#(#neg(#s(#s(@x)))) -> c_82() , 84: #succ^#(#pos(#s(@x))) -> c_83() } We are left with following problem, upon which TcT provides the certificate YES(O(1),O(n^2)). Strict DPs: { firstline^#(@l) -> c_8(firstline#1^#(@l)) , firstline#1^#(::(@x, @xs)) -> c_9(#abs^#(#0()), firstline^#(@xs)) , lcs^#(@l1, @l2) -> c_11(lcs#1^#(lcstable(@l1, @l2)), lcstable^#(@l1, @l2)) , lcstable^#(@l1, @l2) -> c_12(lcstable#1^#(@l1, @l2)) , lcstable#1^#(::(@x, @xs), @l2) -> c_18(lcstable#2^#(lcstable(@xs, @l2), @l2, @x), lcstable^#(@xs, @l2)) , lcstable#1^#(nil(), @l2) -> c_19(firstline^#(@l2)) , lcstable#2^#(@m, @l2, @x) -> c_20(lcstable#3^#(@m, @l2, @x)) , lcstable#3^#(::(@l, @ls), @l2, @x) -> c_21(newline^#(@x, @l, @l2)) , newline^#(@y, @lastline, @l) -> c_23(newline#1^#(@l, @lastline, @y)) , newline#1^#(::(@x, @xs), @lastline, @y) -> c_27(newline#2^#(@lastline, @x, @xs, @y)) , newline#2^#(::(@belowVal, @lastline'), @x, @xs, @y) -> c_29(newline#3^#(newline(@y, @lastline', @xs), @belowVal, @lastline', @x, @y), newline^#(@y, @lastline', @xs)) , newline#3^#(@nl, @belowVal, @lastline', @x, @y) -> c_31(newline#4^#(right(@nl), @belowVal, @lastline', @nl, @x, @y), right^#(@nl)) , newline#4^#(@rightVal, @belowVal, @lastline', @nl, @x, @y) -> c_33(newline#5^#(right(@lastline'), @belowVal, @nl, @rightVal, @x, @y), right^#(@lastline')) } Weak DPs: { #abs^#(#0()) -> c_1() , #equal^#(@x, @y) -> c_5(#eq^#(@x, @y)) , #eq^#(#0(), #0()) -> c_40() , #eq^#(#0(), #neg(@y)) -> c_41() , #eq^#(#0(), #pos(@y)) -> c_42() , #eq^#(#0(), #s(@y)) -> c_43() , #eq^#(#neg(@x), #0()) -> c_44() , #eq^#(#neg(@x), #neg(@y)) -> c_45(#eq^#(@x, @y)) , #eq^#(#neg(@x), #pos(@y)) -> c_46() , #eq^#(#pos(@x), #0()) -> c_47() , #eq^#(#pos(@x), #neg(@y)) -> c_48() , #eq^#(#pos(@x), #pos(@y)) -> c_49(#eq^#(@x, @y)) , #eq^#(#s(@x), #0()) -> c_50() , #eq^#(#s(@x), #s(@y)) -> c_51(#eq^#(@x, @y)) , #eq^#(::(@x_1, @x_2), ::(@y_1, @y_2)) -> c_52(#and^#(#eq(@x_1, @y_1), #eq(@x_2, @y_2)), #eq^#(@x_1, @y_1), #eq^#(@x_2, @y_2)) , #eq^#(::(@x_1, @x_2), nil()) -> c_53() , #eq^#(nil(), ::(@y_1, @y_2)) -> c_54() , #eq^#(nil(), nil()) -> c_55() , #greater^#(@x, @y) -> c_6(#ckgt^#(#compare(@x, @y)), #compare^#(@x, @y)) , #ckgt^#(#EQ()) -> c_68() , #ckgt^#(#GT()) -> c_69() , #ckgt^#(#LT()) -> c_70() , #compare^#(#0(), #0()) -> c_56() , #compare^#(#0(), #neg(@y)) -> c_57() , #compare^#(#0(), #pos(@y)) -> c_58() , #compare^#(#0(), #s(@y)) -> c_59() , #compare^#(#neg(@x), #0()) -> c_60() , #compare^#(#neg(@x), #neg(@y)) -> c_61(#compare^#(@y, @x)) , #compare^#(#neg(@x), #pos(@y)) -> c_62() , #compare^#(#pos(@x), #0()) -> c_63() , #compare^#(#pos(@x), #neg(@y)) -> c_64() , #compare^#(#pos(@x), #pos(@y)) -> c_65(#compare^#(@x, @y)) , #compare^#(#s(@x), #0()) -> c_66() , #compare^#(#s(@x), #s(@y)) -> c_67(#compare^#(@x, @y)) , +^#(@x, @y) -> c_7(#add^#(@x, @y)) , #add^#(#0(), @y) -> c_71() , #add^#(#neg(#s(#0())), @y) -> c_72(#pred^#(@y)) , #add^#(#neg(#s(#s(@x))), @y) -> c_73(#pred^#(#add(#pos(#s(@x)), @y)), #add^#(#pos(#s(@x)), @y)) , #add^#(#pos(#s(#0())), @y) -> c_74(#succ^#(@y)) , #add^#(#pos(#s(#s(@x))), @y) -> c_75(#succ^#(#add(#pos(#s(@x)), @y)), #add^#(#pos(#s(@x)), @y)) , firstline#1^#(nil()) -> c_10() , lcs#1^#(@m) -> c_13(lcs#2^#(@m)) , lcs#2^#(::(@l1, @_@2)) -> c_14(lcs#3^#(@l1)) , lcs#2^#(nil()) -> c_15(#abs^#(#0())) , lcs#3^#(::(@len, @_@1)) -> c_16() , lcs#3^#(nil()) -> c_17(#abs^#(#0())) , lcstable#3^#(nil(), @l2, @x) -> c_22() , newline#1^#(nil(), @lastline, @y) -> c_28() , max^#(@a, @b) -> c_24(max#1^#(#greater(@a, @b), @a, @b), #greater^#(@a, @b)) , max#1^#(#false(), @a, @b) -> c_25() , max#1^#(#true(), @a, @b) -> c_26() , newline#2^#(nil(), @x, @xs, @y) -> c_30() , right^#(@l) -> c_32(right#1^#(@l)) , right#1^#(::(@x, @xs)) -> c_38() , right#1^#(nil()) -> c_39(#abs^#(#0())) , newline#5^#(@diagVal, @belowVal, @nl, @rightVal, @x, @y) -> c_34(newline#6^#(newline#7(#equal(@x, @y), @belowVal, @diagVal, @rightVal), @nl), newline#7^#(#equal(@x, @y), @belowVal, @diagVal, @rightVal), #equal^#(@x, @y)) , newline#6^#(@elem, @nl) -> c_37() , newline#7^#(#false(), @belowVal, @diagVal, @rightVal) -> c_35(max^#(@belowVal, @rightVal)) , newline#7^#(#true(), @belowVal, @diagVal, @rightVal) -> c_36(+^#(@diagVal, #pos(#s(#0())))) , #and^#(#false(), #false()) -> c_84() , #and^#(#false(), #true()) -> c_85() , #and^#(#true(), #false()) -> c_86() , #and^#(#true(), #true()) -> c_87() , #pred^#(#0()) -> c_76() , #pred^#(#neg(#s(@x))) -> c_77() , #pred^#(#pos(#s(#0()))) -> c_78() , #pred^#(#pos(#s(#s(@x)))) -> c_79() , #succ^#(#0()) -> c_80() , #succ^#(#neg(#s(#0()))) -> c_81() , #succ^#(#neg(#s(#s(@x)))) -> c_82() , #succ^#(#pos(#s(@x))) -> c_83() } Weak Trs: { #abs(#0()) -> #0() , #abs(#neg(@x)) -> #pos(@x) , #abs(#pos(@x)) -> #pos(@x) , #abs(#s(@x)) -> #pos(#s(@x)) , #equal(@x, @y) -> #eq(@x, @y) , #eq(#0(), #0()) -> #true() , #eq(#0(), #neg(@y)) -> #false() , #eq(#0(), #pos(@y)) -> #false() , #eq(#0(), #s(@y)) -> #false() , #eq(#neg(@x), #0()) -> #false() , #eq(#neg(@x), #neg(@y)) -> #eq(@x, @y) , #eq(#neg(@x), #pos(@y)) -> #false() , #eq(#pos(@x), #0()) -> #false() , #eq(#pos(@x), #neg(@y)) -> #false() , #eq(#pos(@x), #pos(@y)) -> #eq(@x, @y) , #eq(#s(@x), #0()) -> #false() , #eq(#s(@x), #s(@y)) -> #eq(@x, @y) , #eq(::(@x_1, @x_2), ::(@y_1, @y_2)) -> #and(#eq(@x_1, @y_1), #eq(@x_2, @y_2)) , #eq(::(@x_1, @x_2), nil()) -> #false() , #eq(nil(), ::(@y_1, @y_2)) -> #false() , #eq(nil(), nil()) -> #true() , #greater(@x, @y) -> #ckgt(#compare(@x, @y)) , #compare(#0(), #0()) -> #EQ() , #compare(#0(), #neg(@y)) -> #GT() , #compare(#0(), #pos(@y)) -> #LT() , #compare(#0(), #s(@y)) -> #LT() , #compare(#neg(@x), #0()) -> #LT() , #compare(#neg(@x), #neg(@y)) -> #compare(@y, @x) , #compare(#neg(@x), #pos(@y)) -> #LT() , #compare(#pos(@x), #0()) -> #GT() , #compare(#pos(@x), #neg(@y)) -> #GT() , #compare(#pos(@x), #pos(@y)) -> #compare(@x, @y) , #compare(#s(@x), #0()) -> #GT() , #compare(#s(@x), #s(@y)) -> #compare(@x, @y) , #ckgt(#EQ()) -> #false() , #ckgt(#GT()) -> #true() , #ckgt(#LT()) -> #false() , +(@x, @y) -> #add(@x, @y) , #add(#0(), @y) -> @y , #add(#neg(#s(#0())), @y) -> #pred(@y) , #add(#neg(#s(#s(@x))), @y) -> #pred(#add(#pos(#s(@x)), @y)) , #add(#pos(#s(#0())), @y) -> #succ(@y) , #add(#pos(#s(#s(@x))), @y) -> #succ(#add(#pos(#s(@x)), @y)) , firstline(@l) -> firstline#1(@l) , firstline#1(::(@x, @xs)) -> ::(#abs(#0()), firstline(@xs)) , firstline#1(nil()) -> nil() , lcs(@l1, @l2) -> lcs#1(lcstable(@l1, @l2)) , lcstable(@l1, @l2) -> lcstable#1(@l1, @l2) , lcs#1(@m) -> lcs#2(@m) , lcs#2(::(@l1, @_@2)) -> lcs#3(@l1) , lcs#2(nil()) -> #abs(#0()) , lcs#3(::(@len, @_@1)) -> @len , lcs#3(nil()) -> #abs(#0()) , lcstable#1(::(@x, @xs), @l2) -> lcstable#2(lcstable(@xs, @l2), @l2, @x) , lcstable#1(nil(), @l2) -> ::(firstline(@l2), nil()) , lcstable#2(@m, @l2, @x) -> lcstable#3(@m, @l2, @x) , lcstable#3(::(@l, @ls), @l2, @x) -> ::(newline(@x, @l, @l2), ::(@l, @ls)) , lcstable#3(nil(), @l2, @x) -> nil() , newline(@y, @lastline, @l) -> newline#1(@l, @lastline, @y) , max(@a, @b) -> max#1(#greater(@a, @b), @a, @b) , max#1(#false(), @a, @b) -> @b , max#1(#true(), @a, @b) -> @a , newline#1(::(@x, @xs), @lastline, @y) -> newline#2(@lastline, @x, @xs, @y) , newline#1(nil(), @lastline, @y) -> nil() , newline#2(::(@belowVal, @lastline'), @x, @xs, @y) -> newline#3(newline(@y, @lastline', @xs), @belowVal, @lastline', @x, @y) , newline#2(nil(), @x, @xs, @y) -> nil() , newline#3(@nl, @belowVal, @lastline', @x, @y) -> newline#4(right(@nl), @belowVal, @lastline', @nl, @x, @y) , right(@l) -> right#1(@l) , newline#4(@rightVal, @belowVal, @lastline', @nl, @x, @y) -> newline#5(right(@lastline'), @belowVal, @nl, @rightVal, @x, @y) , newline#5(@diagVal, @belowVal, @nl, @rightVal, @x, @y) -> newline#6(newline#7(#equal(@x, @y), @belowVal, @diagVal, @rightVal), @nl) , newline#7(#false(), @belowVal, @diagVal, @rightVal) -> max(@belowVal, @rightVal) , newline#7(#true(), @belowVal, @diagVal, @rightVal) -> +(@diagVal, #pos(#s(#0()))) , newline#6(@elem, @nl) -> ::(@elem, @nl) , right#1(::(@x, @xs)) -> @x , right#1(nil()) -> #abs(#0()) , #pred(#0()) -> #neg(#s(#0())) , #pred(#neg(#s(@x))) -> #neg(#s(#s(@x))) , #pred(#pos(#s(#0()))) -> #0() , #pred(#pos(#s(#s(@x)))) -> #pos(#s(@x)) , #succ(#0()) -> #pos(#s(#0())) , #succ(#neg(#s(#0()))) -> #0() , #succ(#neg(#s(#s(@x)))) -> #neg(#s(@x)) , #succ(#pos(#s(@x))) -> #pos(#s(#s(@x))) , #and(#false(), #false()) -> #false() , #and(#false(), #true()) -> #false() , #and(#true(), #false()) -> #false() , #and(#true(), #true()) -> #true() } Obligation: innermost runtime complexity Answer: YES(O(1),O(n^2)) We estimate the number of application of {13} by applications of Pre({13}) = {12}. Here rules are labeled as follows: DPs: { 1: firstline^#(@l) -> c_8(firstline#1^#(@l)) , 2: firstline#1^#(::(@x, @xs)) -> c_9(#abs^#(#0()), firstline^#(@xs)) , 3: lcs^#(@l1, @l2) -> c_11(lcs#1^#(lcstable(@l1, @l2)), lcstable^#(@l1, @l2)) , 4: lcstable^#(@l1, @l2) -> c_12(lcstable#1^#(@l1, @l2)) , 5: lcstable#1^#(::(@x, @xs), @l2) -> c_18(lcstable#2^#(lcstable(@xs, @l2), @l2, @x), lcstable^#(@xs, @l2)) , 6: lcstable#1^#(nil(), @l2) -> c_19(firstline^#(@l2)) , 7: lcstable#2^#(@m, @l2, @x) -> c_20(lcstable#3^#(@m, @l2, @x)) , 8: lcstable#3^#(::(@l, @ls), @l2, @x) -> c_21(newline^#(@x, @l, @l2)) , 9: newline^#(@y, @lastline, @l) -> c_23(newline#1^#(@l, @lastline, @y)) , 10: newline#1^#(::(@x, @xs), @lastline, @y) -> c_27(newline#2^#(@lastline, @x, @xs, @y)) , 11: newline#2^#(::(@belowVal, @lastline'), @x, @xs, @y) -> c_29(newline#3^#(newline(@y, @lastline', @xs), @belowVal, @lastline', @x, @y), newline^#(@y, @lastline', @xs)) , 12: newline#3^#(@nl, @belowVal, @lastline', @x, @y) -> c_31(newline#4^#(right(@nl), @belowVal, @lastline', @nl, @x, @y), right^#(@nl)) , 13: newline#4^#(@rightVal, @belowVal, @lastline', @nl, @x, @y) -> c_33(newline#5^#(right(@lastline'), @belowVal, @nl, @rightVal, @x, @y), right^#(@lastline')) , 14: #abs^#(#0()) -> c_1() , 15: #equal^#(@x, @y) -> c_5(#eq^#(@x, @y)) , 16: #eq^#(#0(), #0()) -> c_40() , 17: #eq^#(#0(), #neg(@y)) -> c_41() , 18: #eq^#(#0(), #pos(@y)) -> c_42() , 19: #eq^#(#0(), #s(@y)) -> c_43() , 20: #eq^#(#neg(@x), #0()) -> c_44() , 21: #eq^#(#neg(@x), #neg(@y)) -> c_45(#eq^#(@x, @y)) , 22: #eq^#(#neg(@x), #pos(@y)) -> c_46() , 23: #eq^#(#pos(@x), #0()) -> c_47() , 24: #eq^#(#pos(@x), #neg(@y)) -> c_48() , 25: #eq^#(#pos(@x), #pos(@y)) -> c_49(#eq^#(@x, @y)) , 26: #eq^#(#s(@x), #0()) -> c_50() , 27: #eq^#(#s(@x), #s(@y)) -> c_51(#eq^#(@x, @y)) , 28: #eq^#(::(@x_1, @x_2), ::(@y_1, @y_2)) -> c_52(#and^#(#eq(@x_1, @y_1), #eq(@x_2, @y_2)), #eq^#(@x_1, @y_1), #eq^#(@x_2, @y_2)) , 29: #eq^#(::(@x_1, @x_2), nil()) -> c_53() , 30: #eq^#(nil(), ::(@y_1, @y_2)) -> c_54() , 31: #eq^#(nil(), nil()) -> c_55() , 32: #greater^#(@x, @y) -> c_6(#ckgt^#(#compare(@x, @y)), #compare^#(@x, @y)) , 33: #ckgt^#(#EQ()) -> c_68() , 34: #ckgt^#(#GT()) -> c_69() , 35: #ckgt^#(#LT()) -> c_70() , 36: #compare^#(#0(), #0()) -> c_56() , 37: #compare^#(#0(), #neg(@y)) -> c_57() , 38: #compare^#(#0(), #pos(@y)) -> c_58() , 39: #compare^#(#0(), #s(@y)) -> c_59() , 40: #compare^#(#neg(@x), #0()) -> c_60() , 41: #compare^#(#neg(@x), #neg(@y)) -> c_61(#compare^#(@y, @x)) , 42: #compare^#(#neg(@x), #pos(@y)) -> c_62() , 43: #compare^#(#pos(@x), #0()) -> c_63() , 44: #compare^#(#pos(@x), #neg(@y)) -> c_64() , 45: #compare^#(#pos(@x), #pos(@y)) -> c_65(#compare^#(@x, @y)) , 46: #compare^#(#s(@x), #0()) -> c_66() , 47: #compare^#(#s(@x), #s(@y)) -> c_67(#compare^#(@x, @y)) , 48: +^#(@x, @y) -> c_7(#add^#(@x, @y)) , 49: #add^#(#0(), @y) -> c_71() , 50: #add^#(#neg(#s(#0())), @y) -> c_72(#pred^#(@y)) , 51: #add^#(#neg(#s(#s(@x))), @y) -> c_73(#pred^#(#add(#pos(#s(@x)), @y)), #add^#(#pos(#s(@x)), @y)) , 52: #add^#(#pos(#s(#0())), @y) -> c_74(#succ^#(@y)) , 53: #add^#(#pos(#s(#s(@x))), @y) -> c_75(#succ^#(#add(#pos(#s(@x)), @y)), #add^#(#pos(#s(@x)), @y)) , 54: firstline#1^#(nil()) -> c_10() , 55: lcs#1^#(@m) -> c_13(lcs#2^#(@m)) , 56: lcs#2^#(::(@l1, @_@2)) -> c_14(lcs#3^#(@l1)) , 57: lcs#2^#(nil()) -> c_15(#abs^#(#0())) , 58: lcs#3^#(::(@len, @_@1)) -> c_16() , 59: lcs#3^#(nil()) -> c_17(#abs^#(#0())) , 60: lcstable#3^#(nil(), @l2, @x) -> c_22() , 61: newline#1^#(nil(), @lastline, @y) -> c_28() , 62: max^#(@a, @b) -> c_24(max#1^#(#greater(@a, @b), @a, @b), #greater^#(@a, @b)) , 63: max#1^#(#false(), @a, @b) -> c_25() , 64: max#1^#(#true(), @a, @b) -> c_26() , 65: newline#2^#(nil(), @x, @xs, @y) -> c_30() , 66: right^#(@l) -> c_32(right#1^#(@l)) , 67: right#1^#(::(@x, @xs)) -> c_38() , 68: right#1^#(nil()) -> c_39(#abs^#(#0())) , 69: newline#5^#(@diagVal, @belowVal, @nl, @rightVal, @x, @y) -> c_34(newline#6^#(newline#7(#equal(@x, @y), @belowVal, @diagVal, @rightVal), @nl), newline#7^#(#equal(@x, @y), @belowVal, @diagVal, @rightVal), #equal^#(@x, @y)) , 70: newline#6^#(@elem, @nl) -> c_37() , 71: newline#7^#(#false(), @belowVal, @diagVal, @rightVal) -> c_35(max^#(@belowVal, @rightVal)) , 72: newline#7^#(#true(), @belowVal, @diagVal, @rightVal) -> c_36(+^#(@diagVal, #pos(#s(#0())))) , 73: #and^#(#false(), #false()) -> c_84() , 74: #and^#(#false(), #true()) -> c_85() , 75: #and^#(#true(), #false()) -> c_86() , 76: #and^#(#true(), #true()) -> c_87() , 77: #pred^#(#0()) -> c_76() , 78: #pred^#(#neg(#s(@x))) -> c_77() , 79: #pred^#(#pos(#s(#0()))) -> c_78() , 80: #pred^#(#pos(#s(#s(@x)))) -> c_79() , 81: #succ^#(#0()) -> c_80() , 82: #succ^#(#neg(#s(#0()))) -> c_81() , 83: #succ^#(#neg(#s(#s(@x)))) -> c_82() , 84: #succ^#(#pos(#s(@x))) -> c_83() } We are left with following problem, upon which TcT provides the certificate YES(O(1),O(n^2)). Strict DPs: { firstline^#(@l) -> c_8(firstline#1^#(@l)) , firstline#1^#(::(@x, @xs)) -> c_9(#abs^#(#0()), firstline^#(@xs)) , lcs^#(@l1, @l2) -> c_11(lcs#1^#(lcstable(@l1, @l2)), lcstable^#(@l1, @l2)) , lcstable^#(@l1, @l2) -> c_12(lcstable#1^#(@l1, @l2)) , lcstable#1^#(::(@x, @xs), @l2) -> c_18(lcstable#2^#(lcstable(@xs, @l2), @l2, @x), lcstable^#(@xs, @l2)) , lcstable#1^#(nil(), @l2) -> c_19(firstline^#(@l2)) , lcstable#2^#(@m, @l2, @x) -> c_20(lcstable#3^#(@m, @l2, @x)) , lcstable#3^#(::(@l, @ls), @l2, @x) -> c_21(newline^#(@x, @l, @l2)) , newline^#(@y, @lastline, @l) -> c_23(newline#1^#(@l, @lastline, @y)) , newline#1^#(::(@x, @xs), @lastline, @y) -> c_27(newline#2^#(@lastline, @x, @xs, @y)) , newline#2^#(::(@belowVal, @lastline'), @x, @xs, @y) -> c_29(newline#3^#(newline(@y, @lastline', @xs), @belowVal, @lastline', @x, @y), newline^#(@y, @lastline', @xs)) , newline#3^#(@nl, @belowVal, @lastline', @x, @y) -> c_31(newline#4^#(right(@nl), @belowVal, @lastline', @nl, @x, @y), right^#(@nl)) } Weak DPs: { #abs^#(#0()) -> c_1() , #equal^#(@x, @y) -> c_5(#eq^#(@x, @y)) , #eq^#(#0(), #0()) -> c_40() , #eq^#(#0(), #neg(@y)) -> c_41() , #eq^#(#0(), #pos(@y)) -> c_42() , #eq^#(#0(), #s(@y)) -> c_43() , #eq^#(#neg(@x), #0()) -> c_44() , #eq^#(#neg(@x), #neg(@y)) -> c_45(#eq^#(@x, @y)) , #eq^#(#neg(@x), #pos(@y)) -> c_46() , #eq^#(#pos(@x), #0()) -> c_47() , #eq^#(#pos(@x), #neg(@y)) -> c_48() , #eq^#(#pos(@x), #pos(@y)) -> c_49(#eq^#(@x, @y)) , #eq^#(#s(@x), #0()) -> c_50() , #eq^#(#s(@x), #s(@y)) -> c_51(#eq^#(@x, @y)) , #eq^#(::(@x_1, @x_2), ::(@y_1, @y_2)) -> c_52(#and^#(#eq(@x_1, @y_1), #eq(@x_2, @y_2)), #eq^#(@x_1, @y_1), #eq^#(@x_2, @y_2)) , #eq^#(::(@x_1, @x_2), nil()) -> c_53() , #eq^#(nil(), ::(@y_1, @y_2)) -> c_54() , #eq^#(nil(), nil()) -> c_55() , #greater^#(@x, @y) -> c_6(#ckgt^#(#compare(@x, @y)), #compare^#(@x, @y)) , #ckgt^#(#EQ()) -> c_68() , #ckgt^#(#GT()) -> c_69() , #ckgt^#(#LT()) -> c_70() , #compare^#(#0(), #0()) -> c_56() , #compare^#(#0(), #neg(@y)) -> c_57() , #compare^#(#0(), #pos(@y)) -> c_58() , #compare^#(#0(), #s(@y)) -> c_59() , #compare^#(#neg(@x), #0()) -> c_60() , #compare^#(#neg(@x), #neg(@y)) -> c_61(#compare^#(@y, @x)) , #compare^#(#neg(@x), #pos(@y)) -> c_62() , #compare^#(#pos(@x), #0()) -> c_63() , #compare^#(#pos(@x), #neg(@y)) -> c_64() , #compare^#(#pos(@x), #pos(@y)) -> c_65(#compare^#(@x, @y)) , #compare^#(#s(@x), #0()) -> c_66() , #compare^#(#s(@x), #s(@y)) -> c_67(#compare^#(@x, @y)) , +^#(@x, @y) -> c_7(#add^#(@x, @y)) , #add^#(#0(), @y) -> c_71() , #add^#(#neg(#s(#0())), @y) -> c_72(#pred^#(@y)) , #add^#(#neg(#s(#s(@x))), @y) -> c_73(#pred^#(#add(#pos(#s(@x)), @y)), #add^#(#pos(#s(@x)), @y)) , #add^#(#pos(#s(#0())), @y) -> c_74(#succ^#(@y)) , #add^#(#pos(#s(#s(@x))), @y) -> c_75(#succ^#(#add(#pos(#s(@x)), @y)), #add^#(#pos(#s(@x)), @y)) , firstline#1^#(nil()) -> c_10() , lcs#1^#(@m) -> c_13(lcs#2^#(@m)) , lcs#2^#(::(@l1, @_@2)) -> c_14(lcs#3^#(@l1)) , lcs#2^#(nil()) -> c_15(#abs^#(#0())) , lcs#3^#(::(@len, @_@1)) -> c_16() , lcs#3^#(nil()) -> c_17(#abs^#(#0())) , lcstable#3^#(nil(), @l2, @x) -> c_22() , newline#1^#(nil(), @lastline, @y) -> c_28() , max^#(@a, @b) -> c_24(max#1^#(#greater(@a, @b), @a, @b), #greater^#(@a, @b)) , max#1^#(#false(), @a, @b) -> c_25() , max#1^#(#true(), @a, @b) -> c_26() , newline#2^#(nil(), @x, @xs, @y) -> c_30() , newline#4^#(@rightVal, @belowVal, @lastline', @nl, @x, @y) -> c_33(newline#5^#(right(@lastline'), @belowVal, @nl, @rightVal, @x, @y), right^#(@lastline')) , right^#(@l) -> c_32(right#1^#(@l)) , right#1^#(::(@x, @xs)) -> c_38() , right#1^#(nil()) -> c_39(#abs^#(#0())) , newline#5^#(@diagVal, @belowVal, @nl, @rightVal, @x, @y) -> c_34(newline#6^#(newline#7(#equal(@x, @y), @belowVal, @diagVal, @rightVal), @nl), newline#7^#(#equal(@x, @y), @belowVal, @diagVal, @rightVal), #equal^#(@x, @y)) , newline#6^#(@elem, @nl) -> c_37() , newline#7^#(#false(), @belowVal, @diagVal, @rightVal) -> c_35(max^#(@belowVal, @rightVal)) , newline#7^#(#true(), @belowVal, @diagVal, @rightVal) -> c_36(+^#(@diagVal, #pos(#s(#0())))) , #and^#(#false(), #false()) -> c_84() , #and^#(#false(), #true()) -> c_85() , #and^#(#true(), #false()) -> c_86() , #and^#(#true(), #true()) -> c_87() , #pred^#(#0()) -> c_76() , #pred^#(#neg(#s(@x))) -> c_77() , #pred^#(#pos(#s(#0()))) -> c_78() , #pred^#(#pos(#s(#s(@x)))) -> c_79() , #succ^#(#0()) -> c_80() , #succ^#(#neg(#s(#0()))) -> c_81() , #succ^#(#neg(#s(#s(@x)))) -> c_82() , #succ^#(#pos(#s(@x))) -> c_83() } Weak Trs: { #abs(#0()) -> #0() , #abs(#neg(@x)) -> #pos(@x) , #abs(#pos(@x)) -> #pos(@x) , #abs(#s(@x)) -> #pos(#s(@x)) , #equal(@x, @y) -> #eq(@x, @y) , #eq(#0(), #0()) -> #true() , #eq(#0(), #neg(@y)) -> #false() , #eq(#0(), #pos(@y)) -> #false() , #eq(#0(), #s(@y)) -> #false() , #eq(#neg(@x), #0()) -> #false() , #eq(#neg(@x), #neg(@y)) -> #eq(@x, @y) , #eq(#neg(@x), #pos(@y)) -> #false() , #eq(#pos(@x), #0()) -> #false() , #eq(#pos(@x), #neg(@y)) -> #false() , #eq(#pos(@x), #pos(@y)) -> #eq(@x, @y) , #eq(#s(@x), #0()) -> #false() , #eq(#s(@x), #s(@y)) -> #eq(@x, @y) , #eq(::(@x_1, @x_2), ::(@y_1, @y_2)) -> #and(#eq(@x_1, @y_1), #eq(@x_2, @y_2)) , #eq(::(@x_1, @x_2), nil()) -> #false() , #eq(nil(), ::(@y_1, @y_2)) -> #false() , #eq(nil(), nil()) -> #true() , #greater(@x, @y) -> #ckgt(#compare(@x, @y)) , #compare(#0(), #0()) -> #EQ() , #compare(#0(), #neg(@y)) -> #GT() , #compare(#0(), #pos(@y)) -> #LT() , #compare(#0(), #s(@y)) -> #LT() , #compare(#neg(@x), #0()) -> #LT() , #compare(#neg(@x), #neg(@y)) -> #compare(@y, @x) , #compare(#neg(@x), #pos(@y)) -> #LT() , #compare(#pos(@x), #0()) -> #GT() , #compare(#pos(@x), #neg(@y)) -> #GT() , #compare(#pos(@x), #pos(@y)) -> #compare(@x, @y) , #compare(#s(@x), #0()) -> #GT() , #compare(#s(@x), #s(@y)) -> #compare(@x, @y) , #ckgt(#EQ()) -> #false() , #ckgt(#GT()) -> #true() , #ckgt(#LT()) -> #false() , +(@x, @y) -> #add(@x, @y) , #add(#0(), @y) -> @y , #add(#neg(#s(#0())), @y) -> #pred(@y) , #add(#neg(#s(#s(@x))), @y) -> #pred(#add(#pos(#s(@x)), @y)) , #add(#pos(#s(#0())), @y) -> #succ(@y) , #add(#pos(#s(#s(@x))), @y) -> #succ(#add(#pos(#s(@x)), @y)) , firstline(@l) -> firstline#1(@l) , firstline#1(::(@x, @xs)) -> ::(#abs(#0()), firstline(@xs)) , firstline#1(nil()) -> nil() , lcs(@l1, @l2) -> lcs#1(lcstable(@l1, @l2)) , lcstable(@l1, @l2) -> lcstable#1(@l1, @l2) , lcs#1(@m) -> lcs#2(@m) , lcs#2(::(@l1, @_@2)) -> lcs#3(@l1) , lcs#2(nil()) -> #abs(#0()) , lcs#3(::(@len, @_@1)) -> @len , lcs#3(nil()) -> #abs(#0()) , lcstable#1(::(@x, @xs), @l2) -> lcstable#2(lcstable(@xs, @l2), @l2, @x) , lcstable#1(nil(), @l2) -> ::(firstline(@l2), nil()) , lcstable#2(@m, @l2, @x) -> lcstable#3(@m, @l2, @x) , lcstable#3(::(@l, @ls), @l2, @x) -> ::(newline(@x, @l, @l2), ::(@l, @ls)) , lcstable#3(nil(), @l2, @x) -> nil() , newline(@y, @lastline, @l) -> newline#1(@l, @lastline, @y) , max(@a, @b) -> max#1(#greater(@a, @b), @a, @b) , max#1(#false(), @a, @b) -> @b , max#1(#true(), @a, @b) -> @a , newline#1(::(@x, @xs), @lastline, @y) -> newline#2(@lastline, @x, @xs, @y) , newline#1(nil(), @lastline, @y) -> nil() , newline#2(::(@belowVal, @lastline'), @x, @xs, @y) -> newline#3(newline(@y, @lastline', @xs), @belowVal, @lastline', @x, @y) , newline#2(nil(), @x, @xs, @y) -> nil() , newline#3(@nl, @belowVal, @lastline', @x, @y) -> newline#4(right(@nl), @belowVal, @lastline', @nl, @x, @y) , right(@l) -> right#1(@l) , newline#4(@rightVal, @belowVal, @lastline', @nl, @x, @y) -> newline#5(right(@lastline'), @belowVal, @nl, @rightVal, @x, @y) , newline#5(@diagVal, @belowVal, @nl, @rightVal, @x, @y) -> newline#6(newline#7(#equal(@x, @y), @belowVal, @diagVal, @rightVal), @nl) , newline#7(#false(), @belowVal, @diagVal, @rightVal) -> max(@belowVal, @rightVal) , newline#7(#true(), @belowVal, @diagVal, @rightVal) -> +(@diagVal, #pos(#s(#0()))) , newline#6(@elem, @nl) -> ::(@elem, @nl) , right#1(::(@x, @xs)) -> @x , right#1(nil()) -> #abs(#0()) , #pred(#0()) -> #neg(#s(#0())) , #pred(#neg(#s(@x))) -> #neg(#s(#s(@x))) , #pred(#pos(#s(#0()))) -> #0() , #pred(#pos(#s(#s(@x)))) -> #pos(#s(@x)) , #succ(#0()) -> #pos(#s(#0())) , #succ(#neg(#s(#0()))) -> #0() , #succ(#neg(#s(#s(@x)))) -> #neg(#s(@x)) , #succ(#pos(#s(@x))) -> #pos(#s(#s(@x))) , #and(#false(), #false()) -> #false() , #and(#false(), #true()) -> #false() , #and(#true(), #false()) -> #false() , #and(#true(), #true()) -> #true() } Obligation: innermost runtime complexity Answer: YES(O(1),O(n^2)) We estimate the number of application of {12} by applications of Pre({12}) = {11}. Here rules are labeled as follows: DPs: { 1: firstline^#(@l) -> c_8(firstline#1^#(@l)) , 2: firstline#1^#(::(@x, @xs)) -> c_9(#abs^#(#0()), firstline^#(@xs)) , 3: lcs^#(@l1, @l2) -> c_11(lcs#1^#(lcstable(@l1, @l2)), lcstable^#(@l1, @l2)) , 4: lcstable^#(@l1, @l2) -> c_12(lcstable#1^#(@l1, @l2)) , 5: lcstable#1^#(::(@x, @xs), @l2) -> c_18(lcstable#2^#(lcstable(@xs, @l2), @l2, @x), lcstable^#(@xs, @l2)) , 6: lcstable#1^#(nil(), @l2) -> c_19(firstline^#(@l2)) , 7: lcstable#2^#(@m, @l2, @x) -> c_20(lcstable#3^#(@m, @l2, @x)) , 8: lcstable#3^#(::(@l, @ls), @l2, @x) -> c_21(newline^#(@x, @l, @l2)) , 9: newline^#(@y, @lastline, @l) -> c_23(newline#1^#(@l, @lastline, @y)) , 10: newline#1^#(::(@x, @xs), @lastline, @y) -> c_27(newline#2^#(@lastline, @x, @xs, @y)) , 11: newline#2^#(::(@belowVal, @lastline'), @x, @xs, @y) -> c_29(newline#3^#(newline(@y, @lastline', @xs), @belowVal, @lastline', @x, @y), newline^#(@y, @lastline', @xs)) , 12: newline#3^#(@nl, @belowVal, @lastline', @x, @y) -> c_31(newline#4^#(right(@nl), @belowVal, @lastline', @nl, @x, @y), right^#(@nl)) , 13: #abs^#(#0()) -> c_1() , 14: #equal^#(@x, @y) -> c_5(#eq^#(@x, @y)) , 15: #eq^#(#0(), #0()) -> c_40() , 16: #eq^#(#0(), #neg(@y)) -> c_41() , 17: #eq^#(#0(), #pos(@y)) -> c_42() , 18: #eq^#(#0(), #s(@y)) -> c_43() , 19: #eq^#(#neg(@x), #0()) -> c_44() , 20: #eq^#(#neg(@x), #neg(@y)) -> c_45(#eq^#(@x, @y)) , 21: #eq^#(#neg(@x), #pos(@y)) -> c_46() , 22: #eq^#(#pos(@x), #0()) -> c_47() , 23: #eq^#(#pos(@x), #neg(@y)) -> c_48() , 24: #eq^#(#pos(@x), #pos(@y)) -> c_49(#eq^#(@x, @y)) , 25: #eq^#(#s(@x), #0()) -> c_50() , 26: #eq^#(#s(@x), #s(@y)) -> c_51(#eq^#(@x, @y)) , 27: #eq^#(::(@x_1, @x_2), ::(@y_1, @y_2)) -> c_52(#and^#(#eq(@x_1, @y_1), #eq(@x_2, @y_2)), #eq^#(@x_1, @y_1), #eq^#(@x_2, @y_2)) , 28: #eq^#(::(@x_1, @x_2), nil()) -> c_53() , 29: #eq^#(nil(), ::(@y_1, @y_2)) -> c_54() , 30: #eq^#(nil(), nil()) -> c_55() , 31: #greater^#(@x, @y) -> c_6(#ckgt^#(#compare(@x, @y)), #compare^#(@x, @y)) , 32: #ckgt^#(#EQ()) -> c_68() , 33: #ckgt^#(#GT()) -> c_69() , 34: #ckgt^#(#LT()) -> c_70() , 35: #compare^#(#0(), #0()) -> c_56() , 36: #compare^#(#0(), #neg(@y)) -> c_57() , 37: #compare^#(#0(), #pos(@y)) -> c_58() , 38: #compare^#(#0(), #s(@y)) -> c_59() , 39: #compare^#(#neg(@x), #0()) -> c_60() , 40: #compare^#(#neg(@x), #neg(@y)) -> c_61(#compare^#(@y, @x)) , 41: #compare^#(#neg(@x), #pos(@y)) -> c_62() , 42: #compare^#(#pos(@x), #0()) -> c_63() , 43: #compare^#(#pos(@x), #neg(@y)) -> c_64() , 44: #compare^#(#pos(@x), #pos(@y)) -> c_65(#compare^#(@x, @y)) , 45: #compare^#(#s(@x), #0()) -> c_66() , 46: #compare^#(#s(@x), #s(@y)) -> c_67(#compare^#(@x, @y)) , 47: +^#(@x, @y) -> c_7(#add^#(@x, @y)) , 48: #add^#(#0(), @y) -> c_71() , 49: #add^#(#neg(#s(#0())), @y) -> c_72(#pred^#(@y)) , 50: #add^#(#neg(#s(#s(@x))), @y) -> c_73(#pred^#(#add(#pos(#s(@x)), @y)), #add^#(#pos(#s(@x)), @y)) , 51: #add^#(#pos(#s(#0())), @y) -> c_74(#succ^#(@y)) , 52: #add^#(#pos(#s(#s(@x))), @y) -> c_75(#succ^#(#add(#pos(#s(@x)), @y)), #add^#(#pos(#s(@x)), @y)) , 53: firstline#1^#(nil()) -> c_10() , 54: lcs#1^#(@m) -> c_13(lcs#2^#(@m)) , 55: lcs#2^#(::(@l1, @_@2)) -> c_14(lcs#3^#(@l1)) , 56: lcs#2^#(nil()) -> c_15(#abs^#(#0())) , 57: lcs#3^#(::(@len, @_@1)) -> c_16() , 58: lcs#3^#(nil()) -> c_17(#abs^#(#0())) , 59: lcstable#3^#(nil(), @l2, @x) -> c_22() , 60: newline#1^#(nil(), @lastline, @y) -> c_28() , 61: max^#(@a, @b) -> c_24(max#1^#(#greater(@a, @b), @a, @b), #greater^#(@a, @b)) , 62: max#1^#(#false(), @a, @b) -> c_25() , 63: max#1^#(#true(), @a, @b) -> c_26() , 64: newline#2^#(nil(), @x, @xs, @y) -> c_30() , 65: newline#4^#(@rightVal, @belowVal, @lastline', @nl, @x, @y) -> c_33(newline#5^#(right(@lastline'), @belowVal, @nl, @rightVal, @x, @y), right^#(@lastline')) , 66: right^#(@l) -> c_32(right#1^#(@l)) , 67: right#1^#(::(@x, @xs)) -> c_38() , 68: right#1^#(nil()) -> c_39(#abs^#(#0())) , 69: newline#5^#(@diagVal, @belowVal, @nl, @rightVal, @x, @y) -> c_34(newline#6^#(newline#7(#equal(@x, @y), @belowVal, @diagVal, @rightVal), @nl), newline#7^#(#equal(@x, @y), @belowVal, @diagVal, @rightVal), #equal^#(@x, @y)) , 70: newline#6^#(@elem, @nl) -> c_37() , 71: newline#7^#(#false(), @belowVal, @diagVal, @rightVal) -> c_35(max^#(@belowVal, @rightVal)) , 72: newline#7^#(#true(), @belowVal, @diagVal, @rightVal) -> c_36(+^#(@diagVal, #pos(#s(#0())))) , 73: #and^#(#false(), #false()) -> c_84() , 74: #and^#(#false(), #true()) -> c_85() , 75: #and^#(#true(), #false()) -> c_86() , 76: #and^#(#true(), #true()) -> c_87() , 77: #pred^#(#0()) -> c_76() , 78: #pred^#(#neg(#s(@x))) -> c_77() , 79: #pred^#(#pos(#s(#0()))) -> c_78() , 80: #pred^#(#pos(#s(#s(@x)))) -> c_79() , 81: #succ^#(#0()) -> c_80() , 82: #succ^#(#neg(#s(#0()))) -> c_81() , 83: #succ^#(#neg(#s(#s(@x)))) -> c_82() , 84: #succ^#(#pos(#s(@x))) -> c_83() } We are left with following problem, upon which TcT provides the certificate YES(O(1),O(n^2)). Strict DPs: { firstline^#(@l) -> c_8(firstline#1^#(@l)) , firstline#1^#(::(@x, @xs)) -> c_9(#abs^#(#0()), firstline^#(@xs)) , lcs^#(@l1, @l2) -> c_11(lcs#1^#(lcstable(@l1, @l2)), lcstable^#(@l1, @l2)) , lcstable^#(@l1, @l2) -> c_12(lcstable#1^#(@l1, @l2)) , lcstable#1^#(::(@x, @xs), @l2) -> c_18(lcstable#2^#(lcstable(@xs, @l2), @l2, @x), lcstable^#(@xs, @l2)) , lcstable#1^#(nil(), @l2) -> c_19(firstline^#(@l2)) , lcstable#2^#(@m, @l2, @x) -> c_20(lcstable#3^#(@m, @l2, @x)) , lcstable#3^#(::(@l, @ls), @l2, @x) -> c_21(newline^#(@x, @l, @l2)) , newline^#(@y, @lastline, @l) -> c_23(newline#1^#(@l, @lastline, @y)) , newline#1^#(::(@x, @xs), @lastline, @y) -> c_27(newline#2^#(@lastline, @x, @xs, @y)) , newline#2^#(::(@belowVal, @lastline'), @x, @xs, @y) -> c_29(newline#3^#(newline(@y, @lastline', @xs), @belowVal, @lastline', @x, @y), newline^#(@y, @lastline', @xs)) } Weak DPs: { #abs^#(#0()) -> c_1() , #equal^#(@x, @y) -> c_5(#eq^#(@x, @y)) , #eq^#(#0(), #0()) -> c_40() , #eq^#(#0(), #neg(@y)) -> c_41() , #eq^#(#0(), #pos(@y)) -> c_42() , #eq^#(#0(), #s(@y)) -> c_43() , #eq^#(#neg(@x), #0()) -> c_44() , #eq^#(#neg(@x), #neg(@y)) -> c_45(#eq^#(@x, @y)) , #eq^#(#neg(@x), #pos(@y)) -> c_46() , #eq^#(#pos(@x), #0()) -> c_47() , #eq^#(#pos(@x), #neg(@y)) -> c_48() , #eq^#(#pos(@x), #pos(@y)) -> c_49(#eq^#(@x, @y)) , #eq^#(#s(@x), #0()) -> c_50() , #eq^#(#s(@x), #s(@y)) -> c_51(#eq^#(@x, @y)) , #eq^#(::(@x_1, @x_2), ::(@y_1, @y_2)) -> c_52(#and^#(#eq(@x_1, @y_1), #eq(@x_2, @y_2)), #eq^#(@x_1, @y_1), #eq^#(@x_2, @y_2)) , #eq^#(::(@x_1, @x_2), nil()) -> c_53() , #eq^#(nil(), ::(@y_1, @y_2)) -> c_54() , #eq^#(nil(), nil()) -> c_55() , #greater^#(@x, @y) -> c_6(#ckgt^#(#compare(@x, @y)), #compare^#(@x, @y)) , #ckgt^#(#EQ()) -> c_68() , #ckgt^#(#GT()) -> c_69() , #ckgt^#(#LT()) -> c_70() , #compare^#(#0(), #0()) -> c_56() , #compare^#(#0(), #neg(@y)) -> c_57() , #compare^#(#0(), #pos(@y)) -> c_58() , #compare^#(#0(), #s(@y)) -> c_59() , #compare^#(#neg(@x), #0()) -> c_60() , #compare^#(#neg(@x), #neg(@y)) -> c_61(#compare^#(@y, @x)) , #compare^#(#neg(@x), #pos(@y)) -> c_62() , #compare^#(#pos(@x), #0()) -> c_63() , #compare^#(#pos(@x), #neg(@y)) -> c_64() , #compare^#(#pos(@x), #pos(@y)) -> c_65(#compare^#(@x, @y)) , #compare^#(#s(@x), #0()) -> c_66() , #compare^#(#s(@x), #s(@y)) -> c_67(#compare^#(@x, @y)) , +^#(@x, @y) -> c_7(#add^#(@x, @y)) , #add^#(#0(), @y) -> c_71() , #add^#(#neg(#s(#0())), @y) -> c_72(#pred^#(@y)) , #add^#(#neg(#s(#s(@x))), @y) -> c_73(#pred^#(#add(#pos(#s(@x)), @y)), #add^#(#pos(#s(@x)), @y)) , #add^#(#pos(#s(#0())), @y) -> c_74(#succ^#(@y)) , #add^#(#pos(#s(#s(@x))), @y) -> c_75(#succ^#(#add(#pos(#s(@x)), @y)), #add^#(#pos(#s(@x)), @y)) , firstline#1^#(nil()) -> c_10() , lcs#1^#(@m) -> c_13(lcs#2^#(@m)) , lcs#2^#(::(@l1, @_@2)) -> c_14(lcs#3^#(@l1)) , lcs#2^#(nil()) -> c_15(#abs^#(#0())) , lcs#3^#(::(@len, @_@1)) -> c_16() , lcs#3^#(nil()) -> c_17(#abs^#(#0())) , lcstable#3^#(nil(), @l2, @x) -> c_22() , newline#1^#(nil(), @lastline, @y) -> c_28() , max^#(@a, @b) -> c_24(max#1^#(#greater(@a, @b), @a, @b), #greater^#(@a, @b)) , max#1^#(#false(), @a, @b) -> c_25() , max#1^#(#true(), @a, @b) -> c_26() , newline#2^#(nil(), @x, @xs, @y) -> c_30() , newline#3^#(@nl, @belowVal, @lastline', @x, @y) -> c_31(newline#4^#(right(@nl), @belowVal, @lastline', @nl, @x, @y), right^#(@nl)) , newline#4^#(@rightVal, @belowVal, @lastline', @nl, @x, @y) -> c_33(newline#5^#(right(@lastline'), @belowVal, @nl, @rightVal, @x, @y), right^#(@lastline')) , right^#(@l) -> c_32(right#1^#(@l)) , right#1^#(::(@x, @xs)) -> c_38() , right#1^#(nil()) -> c_39(#abs^#(#0())) , newline#5^#(@diagVal, @belowVal, @nl, @rightVal, @x, @y) -> c_34(newline#6^#(newline#7(#equal(@x, @y), @belowVal, @diagVal, @rightVal), @nl), newline#7^#(#equal(@x, @y), @belowVal, @diagVal, @rightVal), #equal^#(@x, @y)) , newline#6^#(@elem, @nl) -> c_37() , newline#7^#(#false(), @belowVal, @diagVal, @rightVal) -> c_35(max^#(@belowVal, @rightVal)) , newline#7^#(#true(), @belowVal, @diagVal, @rightVal) -> c_36(+^#(@diagVal, #pos(#s(#0())))) , #and^#(#false(), #false()) -> c_84() , #and^#(#false(), #true()) -> c_85() , #and^#(#true(), #false()) -> c_86() , #and^#(#true(), #true()) -> c_87() , #pred^#(#0()) -> c_76() , #pred^#(#neg(#s(@x))) -> c_77() , #pred^#(#pos(#s(#0()))) -> c_78() , #pred^#(#pos(#s(#s(@x)))) -> c_79() , #succ^#(#0()) -> c_80() , #succ^#(#neg(#s(#0()))) -> c_81() , #succ^#(#neg(#s(#s(@x)))) -> c_82() , #succ^#(#pos(#s(@x))) -> c_83() } Weak Trs: { #abs(#0()) -> #0() , #abs(#neg(@x)) -> #pos(@x) , #abs(#pos(@x)) -> #pos(@x) , #abs(#s(@x)) -> #pos(#s(@x)) , #equal(@x, @y) -> #eq(@x, @y) , #eq(#0(), #0()) -> #true() , #eq(#0(), #neg(@y)) -> #false() , #eq(#0(), #pos(@y)) -> #false() , #eq(#0(), #s(@y)) -> #false() , #eq(#neg(@x), #0()) -> #false() , #eq(#neg(@x), #neg(@y)) -> #eq(@x, @y) , #eq(#neg(@x), #pos(@y)) -> #false() , #eq(#pos(@x), #0()) -> #false() , #eq(#pos(@x), #neg(@y)) -> #false() , #eq(#pos(@x), #pos(@y)) -> #eq(@x, @y) , #eq(#s(@x), #0()) -> #false() , #eq(#s(@x), #s(@y)) -> #eq(@x, @y) , #eq(::(@x_1, @x_2), ::(@y_1, @y_2)) -> #and(#eq(@x_1, @y_1), #eq(@x_2, @y_2)) , #eq(::(@x_1, @x_2), nil()) -> #false() , #eq(nil(), ::(@y_1, @y_2)) -> #false() , #eq(nil(), nil()) -> #true() , #greater(@x, @y) -> #ckgt(#compare(@x, @y)) , #compare(#0(), #0()) -> #EQ() , #compare(#0(), #neg(@y)) -> #GT() , #compare(#0(), #pos(@y)) -> #LT() , #compare(#0(), #s(@y)) -> #LT() , #compare(#neg(@x), #0()) -> #LT() , #compare(#neg(@x), #neg(@y)) -> #compare(@y, @x) , #compare(#neg(@x), #pos(@y)) -> #LT() , #compare(#pos(@x), #0()) -> #GT() , #compare(#pos(@x), #neg(@y)) -> #GT() , #compare(#pos(@x), #pos(@y)) -> #compare(@x, @y) , #compare(#s(@x), #0()) -> #GT() , #compare(#s(@x), #s(@y)) -> #compare(@x, @y) , #ckgt(#EQ()) -> #false() , #ckgt(#GT()) -> #true() , #ckgt(#LT()) -> #false() , +(@x, @y) -> #add(@x, @y) , #add(#0(), @y) -> @y , #add(#neg(#s(#0())), @y) -> #pred(@y) , #add(#neg(#s(#s(@x))), @y) -> #pred(#add(#pos(#s(@x)), @y)) , #add(#pos(#s(#0())), @y) -> #succ(@y) , #add(#pos(#s(#s(@x))), @y) -> #succ(#add(#pos(#s(@x)), @y)) , firstline(@l) -> firstline#1(@l) , firstline#1(::(@x, @xs)) -> ::(#abs(#0()), firstline(@xs)) , firstline#1(nil()) -> nil() , lcs(@l1, @l2) -> lcs#1(lcstable(@l1, @l2)) , lcstable(@l1, @l2) -> lcstable#1(@l1, @l2) , lcs#1(@m) -> lcs#2(@m) , lcs#2(::(@l1, @_@2)) -> lcs#3(@l1) , lcs#2(nil()) -> #abs(#0()) , lcs#3(::(@len, @_@1)) -> @len , lcs#3(nil()) -> #abs(#0()) , lcstable#1(::(@x, @xs), @l2) -> lcstable#2(lcstable(@xs, @l2), @l2, @x) , lcstable#1(nil(), @l2) -> ::(firstline(@l2), nil()) , lcstable#2(@m, @l2, @x) -> lcstable#3(@m, @l2, @x) , lcstable#3(::(@l, @ls), @l2, @x) -> ::(newline(@x, @l, @l2), ::(@l, @ls)) , lcstable#3(nil(), @l2, @x) -> nil() , newline(@y, @lastline, @l) -> newline#1(@l, @lastline, @y) , max(@a, @b) -> max#1(#greater(@a, @b), @a, @b) , max#1(#false(), @a, @b) -> @b , max#1(#true(), @a, @b) -> @a , newline#1(::(@x, @xs), @lastline, @y) -> newline#2(@lastline, @x, @xs, @y) , newline#1(nil(), @lastline, @y) -> nil() , newline#2(::(@belowVal, @lastline'), @x, @xs, @y) -> newline#3(newline(@y, @lastline', @xs), @belowVal, @lastline', @x, @y) , newline#2(nil(), @x, @xs, @y) -> nil() , newline#3(@nl, @belowVal, @lastline', @x, @y) -> newline#4(right(@nl), @belowVal, @lastline', @nl, @x, @y) , right(@l) -> right#1(@l) , newline#4(@rightVal, @belowVal, @lastline', @nl, @x, @y) -> newline#5(right(@lastline'), @belowVal, @nl, @rightVal, @x, @y) , newline#5(@diagVal, @belowVal, @nl, @rightVal, @x, @y) -> newline#6(newline#7(#equal(@x, @y), @belowVal, @diagVal, @rightVal), @nl) , newline#7(#false(), @belowVal, @diagVal, @rightVal) -> max(@belowVal, @rightVal) , newline#7(#true(), @belowVal, @diagVal, @rightVal) -> +(@diagVal, #pos(#s(#0()))) , newline#6(@elem, @nl) -> ::(@elem, @nl) , right#1(::(@x, @xs)) -> @x , right#1(nil()) -> #abs(#0()) , #pred(#0()) -> #neg(#s(#0())) , #pred(#neg(#s(@x))) -> #neg(#s(#s(@x))) , #pred(#pos(#s(#0()))) -> #0() , #pred(#pos(#s(#s(@x)))) -> #pos(#s(@x)) , #succ(#0()) -> #pos(#s(#0())) , #succ(#neg(#s(#0()))) -> #0() , #succ(#neg(#s(#s(@x)))) -> #neg(#s(@x)) , #succ(#pos(#s(@x))) -> #pos(#s(#s(@x))) , #and(#false(), #false()) -> #false() , #and(#false(), #true()) -> #false() , #and(#true(), #false()) -> #false() , #and(#true(), #true()) -> #true() } Obligation: innermost runtime complexity Answer: YES(O(1),O(n^2)) The following weak DPs constitute a sub-graph of the DG that is closed under successors. The DPs are removed. { #abs^#(#0()) -> c_1() , #equal^#(@x, @y) -> c_5(#eq^#(@x, @y)) , #eq^#(#0(), #0()) -> c_40() , #eq^#(#0(), #neg(@y)) -> c_41() , #eq^#(#0(), #pos(@y)) -> c_42() , #eq^#(#0(), #s(@y)) -> c_43() , #eq^#(#neg(@x), #0()) -> c_44() , #eq^#(#neg(@x), #neg(@y)) -> c_45(#eq^#(@x, @y)) , #eq^#(#neg(@x), #pos(@y)) -> c_46() , #eq^#(#pos(@x), #0()) -> c_47() , #eq^#(#pos(@x), #neg(@y)) -> c_48() , #eq^#(#pos(@x), #pos(@y)) -> c_49(#eq^#(@x, @y)) , #eq^#(#s(@x), #0()) -> c_50() , #eq^#(#s(@x), #s(@y)) -> c_51(#eq^#(@x, @y)) , #eq^#(::(@x_1, @x_2), ::(@y_1, @y_2)) -> c_52(#and^#(#eq(@x_1, @y_1), #eq(@x_2, @y_2)), #eq^#(@x_1, @y_1), #eq^#(@x_2, @y_2)) , #eq^#(::(@x_1, @x_2), nil()) -> c_53() , #eq^#(nil(), ::(@y_1, @y_2)) -> c_54() , #eq^#(nil(), nil()) -> c_55() , #greater^#(@x, @y) -> c_6(#ckgt^#(#compare(@x, @y)), #compare^#(@x, @y)) , #ckgt^#(#EQ()) -> c_68() , #ckgt^#(#GT()) -> c_69() , #ckgt^#(#LT()) -> c_70() , #compare^#(#0(), #0()) -> c_56() , #compare^#(#0(), #neg(@y)) -> c_57() , #compare^#(#0(), #pos(@y)) -> c_58() , #compare^#(#0(), #s(@y)) -> c_59() , #compare^#(#neg(@x), #0()) -> c_60() , #compare^#(#neg(@x), #neg(@y)) -> c_61(#compare^#(@y, @x)) , #compare^#(#neg(@x), #pos(@y)) -> c_62() , #compare^#(#pos(@x), #0()) -> c_63() , #compare^#(#pos(@x), #neg(@y)) -> c_64() , #compare^#(#pos(@x), #pos(@y)) -> c_65(#compare^#(@x, @y)) , #compare^#(#s(@x), #0()) -> c_66() , #compare^#(#s(@x), #s(@y)) -> c_67(#compare^#(@x, @y)) , +^#(@x, @y) -> c_7(#add^#(@x, @y)) , #add^#(#0(), @y) -> c_71() , #add^#(#neg(#s(#0())), @y) -> c_72(#pred^#(@y)) , #add^#(#neg(#s(#s(@x))), @y) -> c_73(#pred^#(#add(#pos(#s(@x)), @y)), #add^#(#pos(#s(@x)), @y)) , #add^#(#pos(#s(#0())), @y) -> c_74(#succ^#(@y)) , #add^#(#pos(#s(#s(@x))), @y) -> c_75(#succ^#(#add(#pos(#s(@x)), @y)), #add^#(#pos(#s(@x)), @y)) , firstline#1^#(nil()) -> c_10() , lcs#1^#(@m) -> c_13(lcs#2^#(@m)) , lcs#2^#(::(@l1, @_@2)) -> c_14(lcs#3^#(@l1)) , lcs#2^#(nil()) -> c_15(#abs^#(#0())) , lcs#3^#(::(@len, @_@1)) -> c_16() , lcs#3^#(nil()) -> c_17(#abs^#(#0())) , lcstable#3^#(nil(), @l2, @x) -> c_22() , newline#1^#(nil(), @lastline, @y) -> c_28() , max^#(@a, @b) -> c_24(max#1^#(#greater(@a, @b), @a, @b), #greater^#(@a, @b)) , max#1^#(#false(), @a, @b) -> c_25() , max#1^#(#true(), @a, @b) -> c_26() , newline#2^#(nil(), @x, @xs, @y) -> c_30() , newline#3^#(@nl, @belowVal, @lastline', @x, @y) -> c_31(newline#4^#(right(@nl), @belowVal, @lastline', @nl, @x, @y), right^#(@nl)) , newline#4^#(@rightVal, @belowVal, @lastline', @nl, @x, @y) -> c_33(newline#5^#(right(@lastline'), @belowVal, @nl, @rightVal, @x, @y), right^#(@lastline')) , right^#(@l) -> c_32(right#1^#(@l)) , right#1^#(::(@x, @xs)) -> c_38() , right#1^#(nil()) -> c_39(#abs^#(#0())) , newline#5^#(@diagVal, @belowVal, @nl, @rightVal, @x, @y) -> c_34(newline#6^#(newline#7(#equal(@x, @y), @belowVal, @diagVal, @rightVal), @nl), newline#7^#(#equal(@x, @y), @belowVal, @diagVal, @rightVal), #equal^#(@x, @y)) , newline#6^#(@elem, @nl) -> c_37() , newline#7^#(#false(), @belowVal, @diagVal, @rightVal) -> c_35(max^#(@belowVal, @rightVal)) , newline#7^#(#true(), @belowVal, @diagVal, @rightVal) -> c_36(+^#(@diagVal, #pos(#s(#0())))) , #and^#(#false(), #false()) -> c_84() , #and^#(#false(), #true()) -> c_85() , #and^#(#true(), #false()) -> c_86() , #and^#(#true(), #true()) -> c_87() , #pred^#(#0()) -> c_76() , #pred^#(#neg(#s(@x))) -> c_77() , #pred^#(#pos(#s(#0()))) -> c_78() , #pred^#(#pos(#s(#s(@x)))) -> c_79() , #succ^#(#0()) -> c_80() , #succ^#(#neg(#s(#0()))) -> c_81() , #succ^#(#neg(#s(#s(@x)))) -> c_82() , #succ^#(#pos(#s(@x))) -> c_83() } We are left with following problem, upon which TcT provides the certificate YES(O(1),O(n^2)). Strict DPs: { firstline^#(@l) -> c_8(firstline#1^#(@l)) , firstline#1^#(::(@x, @xs)) -> c_9(#abs^#(#0()), firstline^#(@xs)) , lcs^#(@l1, @l2) -> c_11(lcs#1^#(lcstable(@l1, @l2)), lcstable^#(@l1, @l2)) , lcstable^#(@l1, @l2) -> c_12(lcstable#1^#(@l1, @l2)) , lcstable#1^#(::(@x, @xs), @l2) -> c_18(lcstable#2^#(lcstable(@xs, @l2), @l2, @x), lcstable^#(@xs, @l2)) , lcstable#1^#(nil(), @l2) -> c_19(firstline^#(@l2)) , lcstable#2^#(@m, @l2, @x) -> c_20(lcstable#3^#(@m, @l2, @x)) , lcstable#3^#(::(@l, @ls), @l2, @x) -> c_21(newline^#(@x, @l, @l2)) , newline^#(@y, @lastline, @l) -> c_23(newline#1^#(@l, @lastline, @y)) , newline#1^#(::(@x, @xs), @lastline, @y) -> c_27(newline#2^#(@lastline, @x, @xs, @y)) , newline#2^#(::(@belowVal, @lastline'), @x, @xs, @y) -> c_29(newline#3^#(newline(@y, @lastline', @xs), @belowVal, @lastline', @x, @y), newline^#(@y, @lastline', @xs)) } Weak Trs: { #abs(#0()) -> #0() , #abs(#neg(@x)) -> #pos(@x) , #abs(#pos(@x)) -> #pos(@x) , #abs(#s(@x)) -> #pos(#s(@x)) , #equal(@x, @y) -> #eq(@x, @y) , #eq(#0(), #0()) -> #true() , #eq(#0(), #neg(@y)) -> #false() , #eq(#0(), #pos(@y)) -> #false() , #eq(#0(), #s(@y)) -> #false() , #eq(#neg(@x), #0()) -> #false() , #eq(#neg(@x), #neg(@y)) -> #eq(@x, @y) , #eq(#neg(@x), #pos(@y)) -> #false() , #eq(#pos(@x), #0()) -> #false() , #eq(#pos(@x), #neg(@y)) -> #false() , #eq(#pos(@x), #pos(@y)) -> #eq(@x, @y) , #eq(#s(@x), #0()) -> #false() , #eq(#s(@x), #s(@y)) -> #eq(@x, @y) , #eq(::(@x_1, @x_2), ::(@y_1, @y_2)) -> #and(#eq(@x_1, @y_1), #eq(@x_2, @y_2)) , #eq(::(@x_1, @x_2), nil()) -> #false() , #eq(nil(), ::(@y_1, @y_2)) -> #false() , #eq(nil(), nil()) -> #true() , #greater(@x, @y) -> #ckgt(#compare(@x, @y)) , #compare(#0(), #0()) -> #EQ() , #compare(#0(), #neg(@y)) -> #GT() , #compare(#0(), #pos(@y)) -> #LT() , #compare(#0(), #s(@y)) -> #LT() , #compare(#neg(@x), #0()) -> #LT() , #compare(#neg(@x), #neg(@y)) -> #compare(@y, @x) , #compare(#neg(@x), #pos(@y)) -> #LT() , #compare(#pos(@x), #0()) -> #GT() , #compare(#pos(@x), #neg(@y)) -> #GT() , #compare(#pos(@x), #pos(@y)) -> #compare(@x, @y) , #compare(#s(@x), #0()) -> #GT() , #compare(#s(@x), #s(@y)) -> #compare(@x, @y) , #ckgt(#EQ()) -> #false() , #ckgt(#GT()) -> #true() , #ckgt(#LT()) -> #false() , +(@x, @y) -> #add(@x, @y) , #add(#0(), @y) -> @y , #add(#neg(#s(#0())), @y) -> #pred(@y) , #add(#neg(#s(#s(@x))), @y) -> #pred(#add(#pos(#s(@x)), @y)) , #add(#pos(#s(#0())), @y) -> #succ(@y) , #add(#pos(#s(#s(@x))), @y) -> #succ(#add(#pos(#s(@x)), @y)) , firstline(@l) -> firstline#1(@l) , firstline#1(::(@x, @xs)) -> ::(#abs(#0()), firstline(@xs)) , firstline#1(nil()) -> nil() , lcs(@l1, @l2) -> lcs#1(lcstable(@l1, @l2)) , lcstable(@l1, @l2) -> lcstable#1(@l1, @l2) , lcs#1(@m) -> lcs#2(@m) , lcs#2(::(@l1, @_@2)) -> lcs#3(@l1) , lcs#2(nil()) -> #abs(#0()) , lcs#3(::(@len, @_@1)) -> @len , lcs#3(nil()) -> #abs(#0()) , lcstable#1(::(@x, @xs), @l2) -> lcstable#2(lcstable(@xs, @l2), @l2, @x) , lcstable#1(nil(), @l2) -> ::(firstline(@l2), nil()) , lcstable#2(@m, @l2, @x) -> lcstable#3(@m, @l2, @x) , lcstable#3(::(@l, @ls), @l2, @x) -> ::(newline(@x, @l, @l2), ::(@l, @ls)) , lcstable#3(nil(), @l2, @x) -> nil() , newline(@y, @lastline, @l) -> newline#1(@l, @lastline, @y) , max(@a, @b) -> max#1(#greater(@a, @b), @a, @b) , max#1(#false(), @a, @b) -> @b , max#1(#true(), @a, @b) -> @a , newline#1(::(@x, @xs), @lastline, @y) -> newline#2(@lastline, @x, @xs, @y) , newline#1(nil(), @lastline, @y) -> nil() , newline#2(::(@belowVal, @lastline'), @x, @xs, @y) -> newline#3(newline(@y, @lastline', @xs), @belowVal, @lastline', @x, @y) , newline#2(nil(), @x, @xs, @y) -> nil() , newline#3(@nl, @belowVal, @lastline', @x, @y) -> newline#4(right(@nl), @belowVal, @lastline', @nl, @x, @y) , right(@l) -> right#1(@l) , newline#4(@rightVal, @belowVal, @lastline', @nl, @x, @y) -> newline#5(right(@lastline'), @belowVal, @nl, @rightVal, @x, @y) , newline#5(@diagVal, @belowVal, @nl, @rightVal, @x, @y) -> newline#6(newline#7(#equal(@x, @y), @belowVal, @diagVal, @rightVal), @nl) , newline#7(#false(), @belowVal, @diagVal, @rightVal) -> max(@belowVal, @rightVal) , newline#7(#true(), @belowVal, @diagVal, @rightVal) -> +(@diagVal, #pos(#s(#0()))) , newline#6(@elem, @nl) -> ::(@elem, @nl) , right#1(::(@x, @xs)) -> @x , right#1(nil()) -> #abs(#0()) , #pred(#0()) -> #neg(#s(#0())) , #pred(#neg(#s(@x))) -> #neg(#s(#s(@x))) , #pred(#pos(#s(#0()))) -> #0() , #pred(#pos(#s(#s(@x)))) -> #pos(#s(@x)) , #succ(#0()) -> #pos(#s(#0())) , #succ(#neg(#s(#0()))) -> #0() , #succ(#neg(#s(#s(@x)))) -> #neg(#s(@x)) , #succ(#pos(#s(@x))) -> #pos(#s(#s(@x))) , #and(#false(), #false()) -> #false() , #and(#false(), #true()) -> #false() , #and(#true(), #false()) -> #false() , #and(#true(), #true()) -> #true() } Obligation: innermost runtime complexity Answer: YES(O(1),O(n^2)) Due to missing edges in the dependency-graph, the right-hand sides of following rules could be simplified: { firstline#1^#(::(@x, @xs)) -> c_9(#abs^#(#0()), firstline^#(@xs)) , lcs^#(@l1, @l2) -> c_11(lcs#1^#(lcstable(@l1, @l2)), lcstable^#(@l1, @l2)) , newline#2^#(::(@belowVal, @lastline'), @x, @xs, @y) -> c_29(newline#3^#(newline(@y, @lastline', @xs), @belowVal, @lastline', @x, @y), newline^#(@y, @lastline', @xs)) } We are left with following problem, upon which TcT provides the certificate YES(O(1),O(n^2)). Strict DPs: { firstline^#(@l) -> c_1(firstline#1^#(@l)) , firstline#1^#(::(@x, @xs)) -> c_2(firstline^#(@xs)) , lcs^#(@l1, @l2) -> c_3(lcstable^#(@l1, @l2)) , lcstable^#(@l1, @l2) -> c_4(lcstable#1^#(@l1, @l2)) , lcstable#1^#(::(@x, @xs), @l2) -> c_5(lcstable#2^#(lcstable(@xs, @l2), @l2, @x), lcstable^#(@xs, @l2)) , lcstable#1^#(nil(), @l2) -> c_6(firstline^#(@l2)) , lcstable#2^#(@m, @l2, @x) -> c_7(lcstable#3^#(@m, @l2, @x)) , lcstable#3^#(::(@l, @ls), @l2, @x) -> c_8(newline^#(@x, @l, @l2)) , newline^#(@y, @lastline, @l) -> c_9(newline#1^#(@l, @lastline, @y)) , newline#1^#(::(@x, @xs), @lastline, @y) -> c_10(newline#2^#(@lastline, @x, @xs, @y)) , newline#2^#(::(@belowVal, @lastline'), @x, @xs, @y) -> c_11(newline^#(@y, @lastline', @xs)) } Weak Trs: { #abs(#0()) -> #0() , #abs(#neg(@x)) -> #pos(@x) , #abs(#pos(@x)) -> #pos(@x) , #abs(#s(@x)) -> #pos(#s(@x)) , #equal(@x, @y) -> #eq(@x, @y) , #eq(#0(), #0()) -> #true() , #eq(#0(), #neg(@y)) -> #false() , #eq(#0(), #pos(@y)) -> #false() , #eq(#0(), #s(@y)) -> #false() , #eq(#neg(@x), #0()) -> #false() , #eq(#neg(@x), #neg(@y)) -> #eq(@x, @y) , #eq(#neg(@x), #pos(@y)) -> #false() , #eq(#pos(@x), #0()) -> #false() , #eq(#pos(@x), #neg(@y)) -> #false() , #eq(#pos(@x), #pos(@y)) -> #eq(@x, @y) , #eq(#s(@x), #0()) -> #false() , #eq(#s(@x), #s(@y)) -> #eq(@x, @y) , #eq(::(@x_1, @x_2), ::(@y_1, @y_2)) -> #and(#eq(@x_1, @y_1), #eq(@x_2, @y_2)) , #eq(::(@x_1, @x_2), nil()) -> #false() , #eq(nil(), ::(@y_1, @y_2)) -> #false() , #eq(nil(), nil()) -> #true() , #greater(@x, @y) -> #ckgt(#compare(@x, @y)) , #compare(#0(), #0()) -> #EQ() , #compare(#0(), #neg(@y)) -> #GT() , #compare(#0(), #pos(@y)) -> #LT() , #compare(#0(), #s(@y)) -> #LT() , #compare(#neg(@x), #0()) -> #LT() , #compare(#neg(@x), #neg(@y)) -> #compare(@y, @x) , #compare(#neg(@x), #pos(@y)) -> #LT() , #compare(#pos(@x), #0()) -> #GT() , #compare(#pos(@x), #neg(@y)) -> #GT() , #compare(#pos(@x), #pos(@y)) -> #compare(@x, @y) , #compare(#s(@x), #0()) -> #GT() , #compare(#s(@x), #s(@y)) -> #compare(@x, @y) , #ckgt(#EQ()) -> #false() , #ckgt(#GT()) -> #true() , #ckgt(#LT()) -> #false() , +(@x, @y) -> #add(@x, @y) , #add(#0(), @y) -> @y , #add(#neg(#s(#0())), @y) -> #pred(@y) , #add(#neg(#s(#s(@x))), @y) -> #pred(#add(#pos(#s(@x)), @y)) , #add(#pos(#s(#0())), @y) -> #succ(@y) , #add(#pos(#s(#s(@x))), @y) -> #succ(#add(#pos(#s(@x)), @y)) , firstline(@l) -> firstline#1(@l) , firstline#1(::(@x, @xs)) -> ::(#abs(#0()), firstline(@xs)) , firstline#1(nil()) -> nil() , lcs(@l1, @l2) -> lcs#1(lcstable(@l1, @l2)) , lcstable(@l1, @l2) -> lcstable#1(@l1, @l2) , lcs#1(@m) -> lcs#2(@m) , lcs#2(::(@l1, @_@2)) -> lcs#3(@l1) , lcs#2(nil()) -> #abs(#0()) , lcs#3(::(@len, @_@1)) -> @len , lcs#3(nil()) -> #abs(#0()) , lcstable#1(::(@x, @xs), @l2) -> lcstable#2(lcstable(@xs, @l2), @l2, @x) , lcstable#1(nil(), @l2) -> ::(firstline(@l2), nil()) , lcstable#2(@m, @l2, @x) -> lcstable#3(@m, @l2, @x) , lcstable#3(::(@l, @ls), @l2, @x) -> ::(newline(@x, @l, @l2), ::(@l, @ls)) , lcstable#3(nil(), @l2, @x) -> nil() , newline(@y, @lastline, @l) -> newline#1(@l, @lastline, @y) , max(@a, @b) -> max#1(#greater(@a, @b), @a, @b) , max#1(#false(), @a, @b) -> @b , max#1(#true(), @a, @b) -> @a , newline#1(::(@x, @xs), @lastline, @y) -> newline#2(@lastline, @x, @xs, @y) , newline#1(nil(), @lastline, @y) -> nil() , newline#2(::(@belowVal, @lastline'), @x, @xs, @y) -> newline#3(newline(@y, @lastline', @xs), @belowVal, @lastline', @x, @y) , newline#2(nil(), @x, @xs, @y) -> nil() , newline#3(@nl, @belowVal, @lastline', @x, @y) -> newline#4(right(@nl), @belowVal, @lastline', @nl, @x, @y) , right(@l) -> right#1(@l) , newline#4(@rightVal, @belowVal, @lastline', @nl, @x, @y) -> newline#5(right(@lastline'), @belowVal, @nl, @rightVal, @x, @y) , newline#5(@diagVal, @belowVal, @nl, @rightVal, @x, @y) -> newline#6(newline#7(#equal(@x, @y), @belowVal, @diagVal, @rightVal), @nl) , newline#7(#false(), @belowVal, @diagVal, @rightVal) -> max(@belowVal, @rightVal) , newline#7(#true(), @belowVal, @diagVal, @rightVal) -> +(@diagVal, #pos(#s(#0()))) , newline#6(@elem, @nl) -> ::(@elem, @nl) , right#1(::(@x, @xs)) -> @x , right#1(nil()) -> #abs(#0()) , #pred(#0()) -> #neg(#s(#0())) , #pred(#neg(#s(@x))) -> #neg(#s(#s(@x))) , #pred(#pos(#s(#0()))) -> #0() , #pred(#pos(#s(#s(@x)))) -> #pos(#s(@x)) , #succ(#0()) -> #pos(#s(#0())) , #succ(#neg(#s(#0()))) -> #0() , #succ(#neg(#s(#s(@x)))) -> #neg(#s(@x)) , #succ(#pos(#s(@x))) -> #pos(#s(#s(@x))) , #and(#false(), #false()) -> #false() , #and(#false(), #true()) -> #false() , #and(#true(), #false()) -> #false() , #and(#true(), #true()) -> #true() } Obligation: innermost runtime complexity Answer: YES(O(1),O(n^2)) We replace rewrite rules by usable rules: Weak Usable Rules: { #abs(#0()) -> #0() , #abs(#neg(@x)) -> #pos(@x) , #abs(#pos(@x)) -> #pos(@x) , #abs(#s(@x)) -> #pos(#s(@x)) , #equal(@x, @y) -> #eq(@x, @y) , #eq(#0(), #0()) -> #true() , #eq(#0(), #neg(@y)) -> #false() , #eq(#0(), #pos(@y)) -> #false() , #eq(#0(), #s(@y)) -> #false() , #eq(#neg(@x), #0()) -> #false() , #eq(#neg(@x), #neg(@y)) -> #eq(@x, @y) , #eq(#neg(@x), #pos(@y)) -> #false() , #eq(#pos(@x), #0()) -> #false() , #eq(#pos(@x), #neg(@y)) -> #false() , #eq(#pos(@x), #pos(@y)) -> #eq(@x, @y) , #eq(#s(@x), #0()) -> #false() , #eq(#s(@x), #s(@y)) -> #eq(@x, @y) , #eq(::(@x_1, @x_2), ::(@y_1, @y_2)) -> #and(#eq(@x_1, @y_1), #eq(@x_2, @y_2)) , #eq(::(@x_1, @x_2), nil()) -> #false() , #eq(nil(), ::(@y_1, @y_2)) -> #false() , #eq(nil(), nil()) -> #true() , #greater(@x, @y) -> #ckgt(#compare(@x, @y)) , #compare(#0(), #0()) -> #EQ() , #compare(#0(), #neg(@y)) -> #GT() , #compare(#0(), #pos(@y)) -> #LT() , #compare(#0(), #s(@y)) -> #LT() , #compare(#neg(@x), #0()) -> #LT() , #compare(#neg(@x), #neg(@y)) -> #compare(@y, @x) , #compare(#neg(@x), #pos(@y)) -> #LT() , #compare(#pos(@x), #0()) -> #GT() , #compare(#pos(@x), #neg(@y)) -> #GT() , #compare(#pos(@x), #pos(@y)) -> #compare(@x, @y) , #compare(#s(@x), #0()) -> #GT() , #compare(#s(@x), #s(@y)) -> #compare(@x, @y) , #ckgt(#EQ()) -> #false() , #ckgt(#GT()) -> #true() , #ckgt(#LT()) -> #false() , +(@x, @y) -> #add(@x, @y) , #add(#0(), @y) -> @y , #add(#neg(#s(#0())), @y) -> #pred(@y) , #add(#neg(#s(#s(@x))), @y) -> #pred(#add(#pos(#s(@x)), @y)) , #add(#pos(#s(#0())), @y) -> #succ(@y) , #add(#pos(#s(#s(@x))), @y) -> #succ(#add(#pos(#s(@x)), @y)) , firstline(@l) -> firstline#1(@l) , firstline#1(::(@x, @xs)) -> ::(#abs(#0()), firstline(@xs)) , firstline#1(nil()) -> nil() , lcstable(@l1, @l2) -> lcstable#1(@l1, @l2) , lcstable#1(::(@x, @xs), @l2) -> lcstable#2(lcstable(@xs, @l2), @l2, @x) , lcstable#1(nil(), @l2) -> ::(firstline(@l2), nil()) , lcstable#2(@m, @l2, @x) -> lcstable#3(@m, @l2, @x) , lcstable#3(::(@l, @ls), @l2, @x) -> ::(newline(@x, @l, @l2), ::(@l, @ls)) , lcstable#3(nil(), @l2, @x) -> nil() , newline(@y, @lastline, @l) -> newline#1(@l, @lastline, @y) , max(@a, @b) -> max#1(#greater(@a, @b), @a, @b) , max#1(#false(), @a, @b) -> @b , max#1(#true(), @a, @b) -> @a , newline#1(::(@x, @xs), @lastline, @y) -> newline#2(@lastline, @x, @xs, @y) , newline#1(nil(), @lastline, @y) -> nil() , newline#2(::(@belowVal, @lastline'), @x, @xs, @y) -> newline#3(newline(@y, @lastline', @xs), @belowVal, @lastline', @x, @y) , newline#2(nil(), @x, @xs, @y) -> nil() , newline#3(@nl, @belowVal, @lastline', @x, @y) -> newline#4(right(@nl), @belowVal, @lastline', @nl, @x, @y) , right(@l) -> right#1(@l) , newline#4(@rightVal, @belowVal, @lastline', @nl, @x, @y) -> newline#5(right(@lastline'), @belowVal, @nl, @rightVal, @x, @y) , newline#5(@diagVal, @belowVal, @nl, @rightVal, @x, @y) -> newline#6(newline#7(#equal(@x, @y), @belowVal, @diagVal, @rightVal), @nl) , newline#7(#false(), @belowVal, @diagVal, @rightVal) -> max(@belowVal, @rightVal) , newline#7(#true(), @belowVal, @diagVal, @rightVal) -> +(@diagVal, #pos(#s(#0()))) , newline#6(@elem, @nl) -> ::(@elem, @nl) , right#1(::(@x, @xs)) -> @x , right#1(nil()) -> #abs(#0()) , #pred(#0()) -> #neg(#s(#0())) , #pred(#neg(#s(@x))) -> #neg(#s(#s(@x))) , #pred(#pos(#s(#0()))) -> #0() , #pred(#pos(#s(#s(@x)))) -> #pos(#s(@x)) , #succ(#0()) -> #pos(#s(#0())) , #succ(#neg(#s(#0()))) -> #0() , #succ(#neg(#s(#s(@x)))) -> #neg(#s(@x)) , #succ(#pos(#s(@x))) -> #pos(#s(#s(@x))) , #and(#false(), #false()) -> #false() , #and(#false(), #true()) -> #false() , #and(#true(), #false()) -> #false() , #and(#true(), #true()) -> #true() } We are left with following problem, upon which TcT provides the certificate YES(O(1),O(n^2)). Strict DPs: { firstline^#(@l) -> c_1(firstline#1^#(@l)) , firstline#1^#(::(@x, @xs)) -> c_2(firstline^#(@xs)) , lcs^#(@l1, @l2) -> c_3(lcstable^#(@l1, @l2)) , lcstable^#(@l1, @l2) -> c_4(lcstable#1^#(@l1, @l2)) , lcstable#1^#(::(@x, @xs), @l2) -> c_5(lcstable#2^#(lcstable(@xs, @l2), @l2, @x), lcstable^#(@xs, @l2)) , lcstable#1^#(nil(), @l2) -> c_6(firstline^#(@l2)) , lcstable#2^#(@m, @l2, @x) -> c_7(lcstable#3^#(@m, @l2, @x)) , lcstable#3^#(::(@l, @ls), @l2, @x) -> c_8(newline^#(@x, @l, @l2)) , newline^#(@y, @lastline, @l) -> c_9(newline#1^#(@l, @lastline, @y)) , newline#1^#(::(@x, @xs), @lastline, @y) -> c_10(newline#2^#(@lastline, @x, @xs, @y)) , newline#2^#(::(@belowVal, @lastline'), @x, @xs, @y) -> c_11(newline^#(@y, @lastline', @xs)) } Weak Trs: { #abs(#0()) -> #0() , #abs(#neg(@x)) -> #pos(@x) , #abs(#pos(@x)) -> #pos(@x) , #abs(#s(@x)) -> #pos(#s(@x)) , #equal(@x, @y) -> #eq(@x, @y) , #eq(#0(), #0()) -> #true() , #eq(#0(), #neg(@y)) -> #false() , #eq(#0(), #pos(@y)) -> #false() , #eq(#0(), #s(@y)) -> #false() , #eq(#neg(@x), #0()) -> #false() , #eq(#neg(@x), #neg(@y)) -> #eq(@x, @y) , #eq(#neg(@x), #pos(@y)) -> #false() , #eq(#pos(@x), #0()) -> #false() , #eq(#pos(@x), #neg(@y)) -> #false() , #eq(#pos(@x), #pos(@y)) -> #eq(@x, @y) , #eq(#s(@x), #0()) -> #false() , #eq(#s(@x), #s(@y)) -> #eq(@x, @y) , #eq(::(@x_1, @x_2), ::(@y_1, @y_2)) -> #and(#eq(@x_1, @y_1), #eq(@x_2, @y_2)) , #eq(::(@x_1, @x_2), nil()) -> #false() , #eq(nil(), ::(@y_1, @y_2)) -> #false() , #eq(nil(), nil()) -> #true() , #greater(@x, @y) -> #ckgt(#compare(@x, @y)) , #compare(#0(), #0()) -> #EQ() , #compare(#0(), #neg(@y)) -> #GT() , #compare(#0(), #pos(@y)) -> #LT() , #compare(#0(), #s(@y)) -> #LT() , #compare(#neg(@x), #0()) -> #LT() , #compare(#neg(@x), #neg(@y)) -> #compare(@y, @x) , #compare(#neg(@x), #pos(@y)) -> #LT() , #compare(#pos(@x), #0()) -> #GT() , #compare(#pos(@x), #neg(@y)) -> #GT() , #compare(#pos(@x), #pos(@y)) -> #compare(@x, @y) , #compare(#s(@x), #0()) -> #GT() , #compare(#s(@x), #s(@y)) -> #compare(@x, @y) , #ckgt(#EQ()) -> #false() , #ckgt(#GT()) -> #true() , #ckgt(#LT()) -> #false() , +(@x, @y) -> #add(@x, @y) , #add(#0(), @y) -> @y , #add(#neg(#s(#0())), @y) -> #pred(@y) , #add(#neg(#s(#s(@x))), @y) -> #pred(#add(#pos(#s(@x)), @y)) , #add(#pos(#s(#0())), @y) -> #succ(@y) , #add(#pos(#s(#s(@x))), @y) -> #succ(#add(#pos(#s(@x)), @y)) , firstline(@l) -> firstline#1(@l) , firstline#1(::(@x, @xs)) -> ::(#abs(#0()), firstline(@xs)) , firstline#1(nil()) -> nil() , lcstable(@l1, @l2) -> lcstable#1(@l1, @l2) , lcstable#1(::(@x, @xs), @l2) -> lcstable#2(lcstable(@xs, @l2), @l2, @x) , lcstable#1(nil(), @l2) -> ::(firstline(@l2), nil()) , lcstable#2(@m, @l2, @x) -> lcstable#3(@m, @l2, @x) , lcstable#3(::(@l, @ls), @l2, @x) -> ::(newline(@x, @l, @l2), ::(@l, @ls)) , lcstable#3(nil(), @l2, @x) -> nil() , newline(@y, @lastline, @l) -> newline#1(@l, @lastline, @y) , max(@a, @b) -> max#1(#greater(@a, @b), @a, @b) , max#1(#false(), @a, @b) -> @b , max#1(#true(), @a, @b) -> @a , newline#1(::(@x, @xs), @lastline, @y) -> newline#2(@lastline, @x, @xs, @y) , newline#1(nil(), @lastline, @y) -> nil() , newline#2(::(@belowVal, @lastline'), @x, @xs, @y) -> newline#3(newline(@y, @lastline', @xs), @belowVal, @lastline', @x, @y) , newline#2(nil(), @x, @xs, @y) -> nil() , newline#3(@nl, @belowVal, @lastline', @x, @y) -> newline#4(right(@nl), @belowVal, @lastline', @nl, @x, @y) , right(@l) -> right#1(@l) , newline#4(@rightVal, @belowVal, @lastline', @nl, @x, @y) -> newline#5(right(@lastline'), @belowVal, @nl, @rightVal, @x, @y) , newline#5(@diagVal, @belowVal, @nl, @rightVal, @x, @y) -> newline#6(newline#7(#equal(@x, @y), @belowVal, @diagVal, @rightVal), @nl) , newline#7(#false(), @belowVal, @diagVal, @rightVal) -> max(@belowVal, @rightVal) , newline#7(#true(), @belowVal, @diagVal, @rightVal) -> +(@diagVal, #pos(#s(#0()))) , newline#6(@elem, @nl) -> ::(@elem, @nl) , right#1(::(@x, @xs)) -> @x , right#1(nil()) -> #abs(#0()) , #pred(#0()) -> #neg(#s(#0())) , #pred(#neg(#s(@x))) -> #neg(#s(#s(@x))) , #pred(#pos(#s(#0()))) -> #0() , #pred(#pos(#s(#s(@x)))) -> #pos(#s(@x)) , #succ(#0()) -> #pos(#s(#0())) , #succ(#neg(#s(#0()))) -> #0() , #succ(#neg(#s(#s(@x)))) -> #neg(#s(@x)) , #succ(#pos(#s(@x))) -> #pos(#s(#s(@x))) , #and(#false(), #false()) -> #false() , #and(#false(), #true()) -> #false() , #and(#true(), #false()) -> #false() , #and(#true(), #true()) -> #true() } Obligation: innermost runtime complexity Answer: YES(O(1),O(n^2)) We decompose the input problem according to the dependency graph into the upper component { lcs^#(@l1, @l2) -> c_3(lcstable^#(@l1, @l2)) , lcstable^#(@l1, @l2) -> c_4(lcstable#1^#(@l1, @l2)) , lcstable#1^#(::(@x, @xs), @l2) -> c_5(lcstable#2^#(lcstable(@xs, @l2), @l2, @x), lcstable^#(@xs, @l2)) } and lower component { firstline^#(@l) -> c_1(firstline#1^#(@l)) , firstline#1^#(::(@x, @xs)) -> c_2(firstline^#(@xs)) , lcstable#1^#(nil(), @l2) -> c_6(firstline^#(@l2)) , lcstable#2^#(@m, @l2, @x) -> c_7(lcstable#3^#(@m, @l2, @x)) , lcstable#3^#(::(@l, @ls), @l2, @x) -> c_8(newline^#(@x, @l, @l2)) , newline^#(@y, @lastline, @l) -> c_9(newline#1^#(@l, @lastline, @y)) , newline#1^#(::(@x, @xs), @lastline, @y) -> c_10(newline#2^#(@lastline, @x, @xs, @y)) , newline#2^#(::(@belowVal, @lastline'), @x, @xs, @y) -> c_11(newline^#(@y, @lastline', @xs)) } Further, following extension rules are added to the lower component. { lcs^#(@l1, @l2) -> lcstable^#(@l1, @l2) , lcstable^#(@l1, @l2) -> lcstable#1^#(@l1, @l2) , lcstable#1^#(::(@x, @xs), @l2) -> lcstable^#(@xs, @l2) , lcstable#1^#(::(@x, @xs), @l2) -> lcstable#2^#(lcstable(@xs, @l2), @l2, @x) } TcT solves the upper component with certificate YES(O(1),O(n^1)). Sub-proof: ---------- We are left with following problem, upon which TcT provides the certificate YES(O(1),O(n^1)). Strict DPs: { lcs^#(@l1, @l2) -> c_3(lcstable^#(@l1, @l2)) , lcstable^#(@l1, @l2) -> c_4(lcstable#1^#(@l1, @l2)) , lcstable#1^#(::(@x, @xs), @l2) -> c_5(lcstable#2^#(lcstable(@xs, @l2), @l2, @x), lcstable^#(@xs, @l2)) } Weak Trs: { #abs(#0()) -> #0() , #abs(#neg(@x)) -> #pos(@x) , #abs(#pos(@x)) -> #pos(@x) , #abs(#s(@x)) -> #pos(#s(@x)) , #equal(@x, @y) -> #eq(@x, @y) , #eq(#0(), #0()) -> #true() , #eq(#0(), #neg(@y)) -> #false() , #eq(#0(), #pos(@y)) -> #false() , #eq(#0(), #s(@y)) -> #false() , #eq(#neg(@x), #0()) -> #false() , #eq(#neg(@x), #neg(@y)) -> #eq(@x, @y) , #eq(#neg(@x), #pos(@y)) -> #false() , #eq(#pos(@x), #0()) -> #false() , #eq(#pos(@x), #neg(@y)) -> #false() , #eq(#pos(@x), #pos(@y)) -> #eq(@x, @y) , #eq(#s(@x), #0()) -> #false() , #eq(#s(@x), #s(@y)) -> #eq(@x, @y) , #eq(::(@x_1, @x_2), ::(@y_1, @y_2)) -> #and(#eq(@x_1, @y_1), #eq(@x_2, @y_2)) , #eq(::(@x_1, @x_2), nil()) -> #false() , #eq(nil(), ::(@y_1, @y_2)) -> #false() , #eq(nil(), nil()) -> #true() , #greater(@x, @y) -> #ckgt(#compare(@x, @y)) , #compare(#0(), #0()) -> #EQ() , #compare(#0(), #neg(@y)) -> #GT() , #compare(#0(), #pos(@y)) -> #LT() , #compare(#0(), #s(@y)) -> #LT() , #compare(#neg(@x), #0()) -> #LT() , #compare(#neg(@x), #neg(@y)) -> #compare(@y, @x) , #compare(#neg(@x), #pos(@y)) -> #LT() , #compare(#pos(@x), #0()) -> #GT() , #compare(#pos(@x), #neg(@y)) -> #GT() , #compare(#pos(@x), #pos(@y)) -> #compare(@x, @y) , #compare(#s(@x), #0()) -> #GT() , #compare(#s(@x), #s(@y)) -> #compare(@x, @y) , #ckgt(#EQ()) -> #false() , #ckgt(#GT()) -> #true() , #ckgt(#LT()) -> #false() , +(@x, @y) -> #add(@x, @y) , #add(#0(), @y) -> @y , #add(#neg(#s(#0())), @y) -> #pred(@y) , #add(#neg(#s(#s(@x))), @y) -> #pred(#add(#pos(#s(@x)), @y)) , #add(#pos(#s(#0())), @y) -> #succ(@y) , #add(#pos(#s(#s(@x))), @y) -> #succ(#add(#pos(#s(@x)), @y)) , firstline(@l) -> firstline#1(@l) , firstline#1(::(@x, @xs)) -> ::(#abs(#0()), firstline(@xs)) , firstline#1(nil()) -> nil() , lcstable(@l1, @l2) -> lcstable#1(@l1, @l2) , lcstable#1(::(@x, @xs), @l2) -> lcstable#2(lcstable(@xs, @l2), @l2, @x) , lcstable#1(nil(), @l2) -> ::(firstline(@l2), nil()) , lcstable#2(@m, @l2, @x) -> lcstable#3(@m, @l2, @x) , lcstable#3(::(@l, @ls), @l2, @x) -> ::(newline(@x, @l, @l2), ::(@l, @ls)) , lcstable#3(nil(), @l2, @x) -> nil() , newline(@y, @lastline, @l) -> newline#1(@l, @lastline, @y) , max(@a, @b) -> max#1(#greater(@a, @b), @a, @b) , max#1(#false(), @a, @b) -> @b , max#1(#true(), @a, @b) -> @a , newline#1(::(@x, @xs), @lastline, @y) -> newline#2(@lastline, @x, @xs, @y) , newline#1(nil(), @lastline, @y) -> nil() , newline#2(::(@belowVal, @lastline'), @x, @xs, @y) -> newline#3(newline(@y, @lastline', @xs), @belowVal, @lastline', @x, @y) , newline#2(nil(), @x, @xs, @y) -> nil() , newline#3(@nl, @belowVal, @lastline', @x, @y) -> newline#4(right(@nl), @belowVal, @lastline', @nl, @x, @y) , right(@l) -> right#1(@l) , newline#4(@rightVal, @belowVal, @lastline', @nl, @x, @y) -> newline#5(right(@lastline'), @belowVal, @nl, @rightVal, @x, @y) , newline#5(@diagVal, @belowVal, @nl, @rightVal, @x, @y) -> newline#6(newline#7(#equal(@x, @y), @belowVal, @diagVal, @rightVal), @nl) , newline#7(#false(), @belowVal, @diagVal, @rightVal) -> max(@belowVal, @rightVal) , newline#7(#true(), @belowVal, @diagVal, @rightVal) -> +(@diagVal, #pos(#s(#0()))) , newline#6(@elem, @nl) -> ::(@elem, @nl) , right#1(::(@x, @xs)) -> @x , right#1(nil()) -> #abs(#0()) , #pred(#0()) -> #neg(#s(#0())) , #pred(#neg(#s(@x))) -> #neg(#s(#s(@x))) , #pred(#pos(#s(#0()))) -> #0() , #pred(#pos(#s(#s(@x)))) -> #pos(#s(@x)) , #succ(#0()) -> #pos(#s(#0())) , #succ(#neg(#s(#0()))) -> #0() , #succ(#neg(#s(#s(@x)))) -> #neg(#s(@x)) , #succ(#pos(#s(@x))) -> #pos(#s(#s(@x))) , #and(#false(), #false()) -> #false() , #and(#false(), #true()) -> #false() , #and(#true(), #false()) -> #false() , #and(#true(), #true()) -> #true() } Obligation: innermost runtime complexity Answer: YES(O(1),O(n^1)) Due to missing edges in the dependency-graph, the right-hand sides of following rules could be simplified: { lcstable#1^#(::(@x, @xs), @l2) -> c_5(lcstable#2^#(lcstable(@xs, @l2), @l2, @x), lcstable^#(@xs, @l2)) } We are left with following problem, upon which TcT provides the certificate YES(O(1),O(n^1)). Strict DPs: { lcs^#(@l1, @l2) -> c_1(lcstable^#(@l1, @l2)) , lcstable^#(@l1, @l2) -> c_2(lcstable#1^#(@l1, @l2)) , lcstable#1^#(::(@x, @xs), @l2) -> c_3(lcstable^#(@xs, @l2)) } Weak Trs: { #abs(#0()) -> #0() , #abs(#neg(@x)) -> #pos(@x) , #abs(#pos(@x)) -> #pos(@x) , #abs(#s(@x)) -> #pos(#s(@x)) , #equal(@x, @y) -> #eq(@x, @y) , #eq(#0(), #0()) -> #true() , #eq(#0(), #neg(@y)) -> #false() , #eq(#0(), #pos(@y)) -> #false() , #eq(#0(), #s(@y)) -> #false() , #eq(#neg(@x), #0()) -> #false() , #eq(#neg(@x), #neg(@y)) -> #eq(@x, @y) , #eq(#neg(@x), #pos(@y)) -> #false() , #eq(#pos(@x), #0()) -> #false() , #eq(#pos(@x), #neg(@y)) -> #false() , #eq(#pos(@x), #pos(@y)) -> #eq(@x, @y) , #eq(#s(@x), #0()) -> #false() , #eq(#s(@x), #s(@y)) -> #eq(@x, @y) , #eq(::(@x_1, @x_2), ::(@y_1, @y_2)) -> #and(#eq(@x_1, @y_1), #eq(@x_2, @y_2)) , #eq(::(@x_1, @x_2), nil()) -> #false() , #eq(nil(), ::(@y_1, @y_2)) -> #false() , #eq(nil(), nil()) -> #true() , #greater(@x, @y) -> #ckgt(#compare(@x, @y)) , #compare(#0(), #0()) -> #EQ() , #compare(#0(), #neg(@y)) -> #GT() , #compare(#0(), #pos(@y)) -> #LT() , #compare(#0(), #s(@y)) -> #LT() , #compare(#neg(@x), #0()) -> #LT() , #compare(#neg(@x), #neg(@y)) -> #compare(@y, @x) , #compare(#neg(@x), #pos(@y)) -> #LT() , #compare(#pos(@x), #0()) -> #GT() , #compare(#pos(@x), #neg(@y)) -> #GT() , #compare(#pos(@x), #pos(@y)) -> #compare(@x, @y) , #compare(#s(@x), #0()) -> #GT() , #compare(#s(@x), #s(@y)) -> #compare(@x, @y) , #ckgt(#EQ()) -> #false() , #ckgt(#GT()) -> #true() , #ckgt(#LT()) -> #false() , +(@x, @y) -> #add(@x, @y) , #add(#0(), @y) -> @y , #add(#neg(#s(#0())), @y) -> #pred(@y) , #add(#neg(#s(#s(@x))), @y) -> #pred(#add(#pos(#s(@x)), @y)) , #add(#pos(#s(#0())), @y) -> #succ(@y) , #add(#pos(#s(#s(@x))), @y) -> #succ(#add(#pos(#s(@x)), @y)) , firstline(@l) -> firstline#1(@l) , firstline#1(::(@x, @xs)) -> ::(#abs(#0()), firstline(@xs)) , firstline#1(nil()) -> nil() , lcstable(@l1, @l2) -> lcstable#1(@l1, @l2) , lcstable#1(::(@x, @xs), @l2) -> lcstable#2(lcstable(@xs, @l2), @l2, @x) , lcstable#1(nil(), @l2) -> ::(firstline(@l2), nil()) , lcstable#2(@m, @l2, @x) -> lcstable#3(@m, @l2, @x) , lcstable#3(::(@l, @ls), @l2, @x) -> ::(newline(@x, @l, @l2), ::(@l, @ls)) , lcstable#3(nil(), @l2, @x) -> nil() , newline(@y, @lastline, @l) -> newline#1(@l, @lastline, @y) , max(@a, @b) -> max#1(#greater(@a, @b), @a, @b) , max#1(#false(), @a, @b) -> @b , max#1(#true(), @a, @b) -> @a , newline#1(::(@x, @xs), @lastline, @y) -> newline#2(@lastline, @x, @xs, @y) , newline#1(nil(), @lastline, @y) -> nil() , newline#2(::(@belowVal, @lastline'), @x, @xs, @y) -> newline#3(newline(@y, @lastline', @xs), @belowVal, @lastline', @x, @y) , newline#2(nil(), @x, @xs, @y) -> nil() , newline#3(@nl, @belowVal, @lastline', @x, @y) -> newline#4(right(@nl), @belowVal, @lastline', @nl, @x, @y) , right(@l) -> right#1(@l) , newline#4(@rightVal, @belowVal, @lastline', @nl, @x, @y) -> newline#5(right(@lastline'), @belowVal, @nl, @rightVal, @x, @y) , newline#5(@diagVal, @belowVal, @nl, @rightVal, @x, @y) -> newline#6(newline#7(#equal(@x, @y), @belowVal, @diagVal, @rightVal), @nl) , newline#7(#false(), @belowVal, @diagVal, @rightVal) -> max(@belowVal, @rightVal) , newline#7(#true(), @belowVal, @diagVal, @rightVal) -> +(@diagVal, #pos(#s(#0()))) , newline#6(@elem, @nl) -> ::(@elem, @nl) , right#1(::(@x, @xs)) -> @x , right#1(nil()) -> #abs(#0()) , #pred(#0()) -> #neg(#s(#0())) , #pred(#neg(#s(@x))) -> #neg(#s(#s(@x))) , #pred(#pos(#s(#0()))) -> #0() , #pred(#pos(#s(#s(@x)))) -> #pos(#s(@x)) , #succ(#0()) -> #pos(#s(#0())) , #succ(#neg(#s(#0()))) -> #0() , #succ(#neg(#s(#s(@x)))) -> #neg(#s(@x)) , #succ(#pos(#s(@x))) -> #pos(#s(#s(@x))) , #and(#false(), #false()) -> #false() , #and(#false(), #true()) -> #false() , #and(#true(), #false()) -> #false() , #and(#true(), #true()) -> #true() } Obligation: innermost runtime complexity Answer: YES(O(1),O(n^1)) Consider the dependency graph 1: lcs^#(@l1, @l2) -> c_1(lcstable^#(@l1, @l2)) -->_1 lcstable^#(@l1, @l2) -> c_2(lcstable#1^#(@l1, @l2)) :2 2: lcstable^#(@l1, @l2) -> c_2(lcstable#1^#(@l1, @l2)) -->_1 lcstable#1^#(::(@x, @xs), @l2) -> c_3(lcstable^#(@xs, @l2)) :3 3: lcstable#1^#(::(@x, @xs), @l2) -> c_3(lcstable^#(@xs, @l2)) -->_1 lcstable^#(@l1, @l2) -> c_2(lcstable#1^#(@l1, @l2)) :2 Following roots of the dependency graph are removed, as the considered set of starting terms is closed under reduction with respect to these rules (modulo compound contexts). { lcs^#(@l1, @l2) -> c_1(lcstable^#(@l1, @l2)) } We are left with following problem, upon which TcT provides the certificate YES(O(1),O(n^1)). Strict DPs: { lcstable^#(@l1, @l2) -> c_2(lcstable#1^#(@l1, @l2)) , lcstable#1^#(::(@x, @xs), @l2) -> c_3(lcstable^#(@xs, @l2)) } Weak Trs: { #abs(#0()) -> #0() , #abs(#neg(@x)) -> #pos(@x) , #abs(#pos(@x)) -> #pos(@x) , #abs(#s(@x)) -> #pos(#s(@x)) , #equal(@x, @y) -> #eq(@x, @y) , #eq(#0(), #0()) -> #true() , #eq(#0(), #neg(@y)) -> #false() , #eq(#0(), #pos(@y)) -> #false() , #eq(#0(), #s(@y)) -> #false() , #eq(#neg(@x), #0()) -> #false() , #eq(#neg(@x), #neg(@y)) -> #eq(@x, @y) , #eq(#neg(@x), #pos(@y)) -> #false() , #eq(#pos(@x), #0()) -> #false() , #eq(#pos(@x), #neg(@y)) -> #false() , #eq(#pos(@x), #pos(@y)) -> #eq(@x, @y) , #eq(#s(@x), #0()) -> #false() , #eq(#s(@x), #s(@y)) -> #eq(@x, @y) , #eq(::(@x_1, @x_2), ::(@y_1, @y_2)) -> #and(#eq(@x_1, @y_1), #eq(@x_2, @y_2)) , #eq(::(@x_1, @x_2), nil()) -> #false() , #eq(nil(), ::(@y_1, @y_2)) -> #false() , #eq(nil(), nil()) -> #true() , #greater(@x, @y) -> #ckgt(#compare(@x, @y)) , #compare(#0(), #0()) -> #EQ() , #compare(#0(), #neg(@y)) -> #GT() , #compare(#0(), #pos(@y)) -> #LT() , #compare(#0(), #s(@y)) -> #LT() , #compare(#neg(@x), #0()) -> #LT() , #compare(#neg(@x), #neg(@y)) -> #compare(@y, @x) , #compare(#neg(@x), #pos(@y)) -> #LT() , #compare(#pos(@x), #0()) -> #GT() , #compare(#pos(@x), #neg(@y)) -> #GT() , #compare(#pos(@x), #pos(@y)) -> #compare(@x, @y) , #compare(#s(@x), #0()) -> #GT() , #compare(#s(@x), #s(@y)) -> #compare(@x, @y) , #ckgt(#EQ()) -> #false() , #ckgt(#GT()) -> #true() , #ckgt(#LT()) -> #false() , +(@x, @y) -> #add(@x, @y) , #add(#0(), @y) -> @y , #add(#neg(#s(#0())), @y) -> #pred(@y) , #add(#neg(#s(#s(@x))), @y) -> #pred(#add(#pos(#s(@x)), @y)) , #add(#pos(#s(#0())), @y) -> #succ(@y) , #add(#pos(#s(#s(@x))), @y) -> #succ(#add(#pos(#s(@x)), @y)) , firstline(@l) -> firstline#1(@l) , firstline#1(::(@x, @xs)) -> ::(#abs(#0()), firstline(@xs)) , firstline#1(nil()) -> nil() , lcstable(@l1, @l2) -> lcstable#1(@l1, @l2) , lcstable#1(::(@x, @xs), @l2) -> lcstable#2(lcstable(@xs, @l2), @l2, @x) , lcstable#1(nil(), @l2) -> ::(firstline(@l2), nil()) , lcstable#2(@m, @l2, @x) -> lcstable#3(@m, @l2, @x) , lcstable#3(::(@l, @ls), @l2, @x) -> ::(newline(@x, @l, @l2), ::(@l, @ls)) , lcstable#3(nil(), @l2, @x) -> nil() , newline(@y, @lastline, @l) -> newline#1(@l, @lastline, @y) , max(@a, @b) -> max#1(#greater(@a, @b), @a, @b) , max#1(#false(), @a, @b) -> @b , max#1(#true(), @a, @b) -> @a , newline#1(::(@x, @xs), @lastline, @y) -> newline#2(@lastline, @x, @xs, @y) , newline#1(nil(), @lastline, @y) -> nil() , newline#2(::(@belowVal, @lastline'), @x, @xs, @y) -> newline#3(newline(@y, @lastline', @xs), @belowVal, @lastline', @x, @y) , newline#2(nil(), @x, @xs, @y) -> nil() , newline#3(@nl, @belowVal, @lastline', @x, @y) -> newline#4(right(@nl), @belowVal, @lastline', @nl, @x, @y) , right(@l) -> right#1(@l) , newline#4(@rightVal, @belowVal, @lastline', @nl, @x, @y) -> newline#5(right(@lastline'), @belowVal, @nl, @rightVal, @x, @y) , newline#5(@diagVal, @belowVal, @nl, @rightVal, @x, @y) -> newline#6(newline#7(#equal(@x, @y), @belowVal, @diagVal, @rightVal), @nl) , newline#7(#false(), @belowVal, @diagVal, @rightVal) -> max(@belowVal, @rightVal) , newline#7(#true(), @belowVal, @diagVal, @rightVal) -> +(@diagVal, #pos(#s(#0()))) , newline#6(@elem, @nl) -> ::(@elem, @nl) , right#1(::(@x, @xs)) -> @x , right#1(nil()) -> #abs(#0()) , #pred(#0()) -> #neg(#s(#0())) , #pred(#neg(#s(@x))) -> #neg(#s(#s(@x))) , #pred(#pos(#s(#0()))) -> #0() , #pred(#pos(#s(#s(@x)))) -> #pos(#s(@x)) , #succ(#0()) -> #pos(#s(#0())) , #succ(#neg(#s(#0()))) -> #0() , #succ(#neg(#s(#s(@x)))) -> #neg(#s(@x)) , #succ(#pos(#s(@x))) -> #pos(#s(#s(@x))) , #and(#false(), #false()) -> #false() , #and(#false(), #true()) -> #false() , #and(#true(), #false()) -> #false() , #and(#true(), #true()) -> #true() } Obligation: innermost runtime complexity Answer: YES(O(1),O(n^1)) No rule is usable, rules are removed from the input problem. We are left with following problem, upon which TcT provides the certificate YES(O(1),O(n^1)). Strict DPs: { lcstable^#(@l1, @l2) -> c_2(lcstable#1^#(@l1, @l2)) , lcstable#1^#(::(@x, @xs), @l2) -> c_3(lcstable^#(@xs, @l2)) } Obligation: innermost runtime complexity Answer: YES(O(1),O(n^1)) We use the processor 'matrix interpretation of dimension 1' to orient following rules strictly. DPs: { 1: lcstable^#(@l1, @l2) -> c_2(lcstable#1^#(@l1, @l2)) } Sub-proof: ---------- The following argument positions are usable: Uargs(c_2) = {1}, Uargs(c_3) = {1} TcT has computed following constructor-based matrix interpretation satisfying not(EDA). [#0] = [0] [#abs](x1) = [0] [#neg](x1) = [0] [#pos](x1) = [0] [#s](x1) = [0] [#equal](x1, x2) = [0] [#eq](x1, x2) = [0] [#greater](x1, x2) = [0] [#compare](x1, x2) = [0] [#ckgt](x1) = [0] [+](x1, x2) = [0] [#add](x1, x2) = [0] [firstline](x1) = [0] [firstline#1](x1) = [0] [::](x1, x2) = [1] x2 + [1] [nil] = [0] [lcstable](x1, x2) = [0] [lcstable#1](x1, x2) = [0] [lcstable#2](x1, x2, x3) = [0] [lcstable#3](x1, x2, x3) = [0] [newline](x1, x2, x3) = [0] [max](x1, x2) = [0] [max#1](x1, x2, x3) = [0] [#false] = [0] [#true] = [0] [newline#1](x1, x2, x3) = [0] [newline#2](x1, x2, x3, x4) = [0] [newline#3](x1, x2, x3, x4, x5) = [0] [right](x1) = [0] [newline#4](x1, x2, x3, x4, x5, x6) = [0] [newline#5](x1, x2, x3, x4, x5, x6) = [0] [newline#7](x1, x2, x3, x4) = [0] [newline#6](x1, x2) = [0] [right#1](x1) = [0] [#pred](x1) = [0] [#succ](x1) = [0] [#and](x1, x2) = [0] [#EQ] = [0] [#GT] = [0] [#LT] = [0] [#abs^#](x1) = [0] [#equal^#](x1, x2) = [0] [#eq^#](x1, x2) = [0] [#greater^#](x1, x2) = [0] [#ckgt^#](x1) = [0] [#compare^#](x1, x2) = [0] [+^#](x1, x2) = [0] [#add^#](x1, x2) = [0] [firstline^#](x1) = [0] [firstline#1^#](x1) = [0] [lcs^#](x1, x2) = [0] [lcs#1^#](x1) = [0] [lcstable^#](x1, x2) = [1] x1 + [1] [lcstable#1^#](x1, x2) = [1] x1 + [0] [lcs#2^#](x1) = [0] [lcs#3^#](x1) = [0] [lcstable#2^#](x1, x2, x3) = [0] [lcstable#3^#](x1, x2, x3) = [0] [newline^#](x1, x2, x3) = [0] [newline#1^#](x1, x2, x3) = [0] [max^#](x1, x2) = [0] [max#1^#](x1, x2, x3) = [0] [newline#2^#](x1, x2, x3, x4) = [0] [newline#3^#](x1, x2, x3, x4, x5) = [0] [newline#4^#](x1, x2, x3, x4, x5, x6) = [0] [right^#](x1) = [0] [right#1^#](x1) = [0] [newline#5^#](x1, x2, x3, x4, x5, x6) = [0] [newline#6^#](x1, x2) = [0] [newline#7^#](x1, x2, x3, x4) = [0] [#and^#](x1, x2) = [0] [#pred^#](x1) = [0] [#succ^#](x1) = [0] [c_3](x1) = [0] [c_4](x1) = [0] [c_5](x1, x2) = [0] [c] = [0] [c_1](x1) = [0] [c_2](x1) = [1] x1 + [0] [c_3](x1) = [1] x1 + [0] This order satisfies following ordering constraints [lcstable^#(@l1, @l2)] = [1] @l1 + [1] > [1] @l1 + [0] = [c_2(lcstable#1^#(@l1, @l2))] [lcstable#1^#(::(@x, @xs), @l2)] = [1] @xs + [1] >= [1] @xs + [1] = [c_3(lcstable^#(@xs, @l2))] Consider the set of all dependency pairs DPs: { 1: lcstable^#(@l1, @l2) -> c_2(lcstable#1^#(@l1, @l2)) , 2: lcstable#1^#(::(@x, @xs), @l2) -> c_3(lcstable^#(@xs, @l2)) } Processor 'matrix interpretation of dimension 1' induces the complexity certificate YES(?,O(n^1)) on application of dependency pairs {1}. These cover all (indirect) predecessors of dependency pairs {1,2}, their number of application is equally bounded. The dependency pairs are shifted into the corresponding weak component(s). We apply the transformation 'removetails' on the sub-problem: Weak DPs: { lcstable^#(@l1, @l2) -> c_2(lcstable#1^#(@l1, @l2)) , lcstable#1^#(::(@x, @xs), @l2) -> c_3(lcstable^#(@xs, @l2)) } StartTerms: basic terms Strategy: innermost The following weak DPs constitute a sub-graph of the DG that is closed under successors. The DPs are removed. { lcstable^#(@l1, @l2) -> c_2(lcstable#1^#(@l1, @l2)) , lcstable#1^#(::(@x, @xs), @l2) -> c_3(lcstable^#(@xs, @l2)) } We are left with following problem, upon which TcT provides the certificate YES(O(1),O(1)). Rules: Empty Obligation: innermost runtime complexity Answer: YES(O(1),O(1)) Empty rules are trivially bounded We return to the main proof. We are left with following problem, upon which TcT provides the certificate YES(O(1),O(n^1)). Strict DPs: { firstline^#(@l) -> c_1(firstline#1^#(@l)) , firstline#1^#(::(@x, @xs)) -> c_2(firstline^#(@xs)) , lcstable#1^#(nil(), @l2) -> c_6(firstline^#(@l2)) , lcstable#2^#(@m, @l2, @x) -> c_7(lcstable#3^#(@m, @l2, @x)) , lcstable#3^#(::(@l, @ls), @l2, @x) -> c_8(newline^#(@x, @l, @l2)) , newline^#(@y, @lastline, @l) -> c_9(newline#1^#(@l, @lastline, @y)) , newline#1^#(::(@x, @xs), @lastline, @y) -> c_10(newline#2^#(@lastline, @x, @xs, @y)) , newline#2^#(::(@belowVal, @lastline'), @x, @xs, @y) -> c_11(newline^#(@y, @lastline', @xs)) } Weak DPs: { lcs^#(@l1, @l2) -> lcstable^#(@l1, @l2) , lcstable^#(@l1, @l2) -> lcstable#1^#(@l1, @l2) , lcstable#1^#(::(@x, @xs), @l2) -> lcstable^#(@xs, @l2) , lcstable#1^#(::(@x, @xs), @l2) -> lcstable#2^#(lcstable(@xs, @l2), @l2, @x) } Weak Trs: { #abs(#0()) -> #0() , #abs(#neg(@x)) -> #pos(@x) , #abs(#pos(@x)) -> #pos(@x) , #abs(#s(@x)) -> #pos(#s(@x)) , #equal(@x, @y) -> #eq(@x, @y) , #eq(#0(), #0()) -> #true() , #eq(#0(), #neg(@y)) -> #false() , #eq(#0(), #pos(@y)) -> #false() , #eq(#0(), #s(@y)) -> #false() , #eq(#neg(@x), #0()) -> #false() , #eq(#neg(@x), #neg(@y)) -> #eq(@x, @y) , #eq(#neg(@x), #pos(@y)) -> #false() , #eq(#pos(@x), #0()) -> #false() , #eq(#pos(@x), #neg(@y)) -> #false() , #eq(#pos(@x), #pos(@y)) -> #eq(@x, @y) , #eq(#s(@x), #0()) -> #false() , #eq(#s(@x), #s(@y)) -> #eq(@x, @y) , #eq(::(@x_1, @x_2), ::(@y_1, @y_2)) -> #and(#eq(@x_1, @y_1), #eq(@x_2, @y_2)) , #eq(::(@x_1, @x_2), nil()) -> #false() , #eq(nil(), ::(@y_1, @y_2)) -> #false() , #eq(nil(), nil()) -> #true() , #greater(@x, @y) -> #ckgt(#compare(@x, @y)) , #compare(#0(), #0()) -> #EQ() , #compare(#0(), #neg(@y)) -> #GT() , #compare(#0(), #pos(@y)) -> #LT() , #compare(#0(), #s(@y)) -> #LT() , #compare(#neg(@x), #0()) -> #LT() , #compare(#neg(@x), #neg(@y)) -> #compare(@y, @x) , #compare(#neg(@x), #pos(@y)) -> #LT() , #compare(#pos(@x), #0()) -> #GT() , #compare(#pos(@x), #neg(@y)) -> #GT() , #compare(#pos(@x), #pos(@y)) -> #compare(@x, @y) , #compare(#s(@x), #0()) -> #GT() , #compare(#s(@x), #s(@y)) -> #compare(@x, @y) , #ckgt(#EQ()) -> #false() , #ckgt(#GT()) -> #true() , #ckgt(#LT()) -> #false() , +(@x, @y) -> #add(@x, @y) , #add(#0(), @y) -> @y , #add(#neg(#s(#0())), @y) -> #pred(@y) , #add(#neg(#s(#s(@x))), @y) -> #pred(#add(#pos(#s(@x)), @y)) , #add(#pos(#s(#0())), @y) -> #succ(@y) , #add(#pos(#s(#s(@x))), @y) -> #succ(#add(#pos(#s(@x)), @y)) , firstline(@l) -> firstline#1(@l) , firstline#1(::(@x, @xs)) -> ::(#abs(#0()), firstline(@xs)) , firstline#1(nil()) -> nil() , lcstable(@l1, @l2) -> lcstable#1(@l1, @l2) , lcstable#1(::(@x, @xs), @l2) -> lcstable#2(lcstable(@xs, @l2), @l2, @x) , lcstable#1(nil(), @l2) -> ::(firstline(@l2), nil()) , lcstable#2(@m, @l2, @x) -> lcstable#3(@m, @l2, @x) , lcstable#3(::(@l, @ls), @l2, @x) -> ::(newline(@x, @l, @l2), ::(@l, @ls)) , lcstable#3(nil(), @l2, @x) -> nil() , newline(@y, @lastline, @l) -> newline#1(@l, @lastline, @y) , max(@a, @b) -> max#1(#greater(@a, @b), @a, @b) , max#1(#false(), @a, @b) -> @b , max#1(#true(), @a, @b) -> @a , newline#1(::(@x, @xs), @lastline, @y) -> newline#2(@lastline, @x, @xs, @y) , newline#1(nil(), @lastline, @y) -> nil() , newline#2(::(@belowVal, @lastline'), @x, @xs, @y) -> newline#3(newline(@y, @lastline', @xs), @belowVal, @lastline', @x, @y) , newline#2(nil(), @x, @xs, @y) -> nil() , newline#3(@nl, @belowVal, @lastline', @x, @y) -> newline#4(right(@nl), @belowVal, @lastline', @nl, @x, @y) , right(@l) -> right#1(@l) , newline#4(@rightVal, @belowVal, @lastline', @nl, @x, @y) -> newline#5(right(@lastline'), @belowVal, @nl, @rightVal, @x, @y) , newline#5(@diagVal, @belowVal, @nl, @rightVal, @x, @y) -> newline#6(newline#7(#equal(@x, @y), @belowVal, @diagVal, @rightVal), @nl) , newline#7(#false(), @belowVal, @diagVal, @rightVal) -> max(@belowVal, @rightVal) , newline#7(#true(), @belowVal, @diagVal, @rightVal) -> +(@diagVal, #pos(#s(#0()))) , newline#6(@elem, @nl) -> ::(@elem, @nl) , right#1(::(@x, @xs)) -> @x , right#1(nil()) -> #abs(#0()) , #pred(#0()) -> #neg(#s(#0())) , #pred(#neg(#s(@x))) -> #neg(#s(#s(@x))) , #pred(#pos(#s(#0()))) -> #0() , #pred(#pos(#s(#s(@x)))) -> #pos(#s(@x)) , #succ(#0()) -> #pos(#s(#0())) , #succ(#neg(#s(#0()))) -> #0() , #succ(#neg(#s(#s(@x)))) -> #neg(#s(@x)) , #succ(#pos(#s(@x))) -> #pos(#s(#s(@x))) , #and(#false(), #false()) -> #false() , #and(#false(), #true()) -> #false() , #and(#true(), #false()) -> #false() , #and(#true(), #true()) -> #true() } Obligation: innermost runtime complexity Answer: YES(O(1),O(n^1)) Consider the dependency graph 1: firstline^#(@l) -> c_1(firstline#1^#(@l)) -->_1 firstline#1^#(::(@x, @xs)) -> c_2(firstline^#(@xs)) :2 2: firstline#1^#(::(@x, @xs)) -> c_2(firstline^#(@xs)) -->_1 firstline^#(@l) -> c_1(firstline#1^#(@l)) :1 3: lcstable#1^#(nil(), @l2) -> c_6(firstline^#(@l2)) -->_1 firstline^#(@l) -> c_1(firstline#1^#(@l)) :1 4: lcstable#2^#(@m, @l2, @x) -> c_7(lcstable#3^#(@m, @l2, @x)) -->_1 lcstable#3^#(::(@l, @ls), @l2, @x) -> c_8(newline^#(@x, @l, @l2)) :5 5: lcstable#3^#(::(@l, @ls), @l2, @x) -> c_8(newline^#(@x, @l, @l2)) -->_1 newline^#(@y, @lastline, @l) -> c_9(newline#1^#(@l, @lastline, @y)) :6 6: newline^#(@y, @lastline, @l) -> c_9(newline#1^#(@l, @lastline, @y)) -->_1 newline#1^#(::(@x, @xs), @lastline, @y) -> c_10(newline#2^#(@lastline, @x, @xs, @y)) :7 7: newline#1^#(::(@x, @xs), @lastline, @y) -> c_10(newline#2^#(@lastline, @x, @xs, @y)) -->_1 newline#2^#(::(@belowVal, @lastline'), @x, @xs, @y) -> c_11(newline^#(@y, @lastline', @xs)) :8 8: newline#2^#(::(@belowVal, @lastline'), @x, @xs, @y) -> c_11(newline^#(@y, @lastline', @xs)) -->_1 newline^#(@y, @lastline, @l) -> c_9(newline#1^#(@l, @lastline, @y)) :6 9: lcs^#(@l1, @l2) -> lcstable^#(@l1, @l2) -->_1 lcstable^#(@l1, @l2) -> lcstable#1^#(@l1, @l2) :10 10: lcstable^#(@l1, @l2) -> lcstable#1^#(@l1, @l2) -->_1 lcstable#1^#(::(@x, @xs), @l2) -> lcstable#2^#(lcstable(@xs, @l2), @l2, @x) :12 -->_1 lcstable#1^#(::(@x, @xs), @l2) -> lcstable^#(@xs, @l2) :11 -->_1 lcstable#1^#(nil(), @l2) -> c_6(firstline^#(@l2)) :3 11: lcstable#1^#(::(@x, @xs), @l2) -> lcstable^#(@xs, @l2) -->_1 lcstable^#(@l1, @l2) -> lcstable#1^#(@l1, @l2) :10 12: lcstable#1^#(::(@x, @xs), @l2) -> lcstable#2^#(lcstable(@xs, @l2), @l2, @x) -->_1 lcstable#2^#(@m, @l2, @x) -> c_7(lcstable#3^#(@m, @l2, @x)) :4 Following roots of the dependency graph are removed, as the considered set of starting terms is closed under reduction with respect to these rules (modulo compound contexts). { lcs^#(@l1, @l2) -> lcstable^#(@l1, @l2) } We are left with following problem, upon which TcT provides the certificate YES(O(1),O(n^1)). Strict DPs: { firstline^#(@l) -> c_1(firstline#1^#(@l)) , firstline#1^#(::(@x, @xs)) -> c_2(firstline^#(@xs)) , lcstable#1^#(nil(), @l2) -> c_6(firstline^#(@l2)) , lcstable#2^#(@m, @l2, @x) -> c_7(lcstable#3^#(@m, @l2, @x)) , lcstable#3^#(::(@l, @ls), @l2, @x) -> c_8(newline^#(@x, @l, @l2)) , newline^#(@y, @lastline, @l) -> c_9(newline#1^#(@l, @lastline, @y)) , newline#1^#(::(@x, @xs), @lastline, @y) -> c_10(newline#2^#(@lastline, @x, @xs, @y)) , newline#2^#(::(@belowVal, @lastline'), @x, @xs, @y) -> c_11(newline^#(@y, @lastline', @xs)) } Weak DPs: { lcstable^#(@l1, @l2) -> lcstable#1^#(@l1, @l2) , lcstable#1^#(::(@x, @xs), @l2) -> lcstable^#(@xs, @l2) , lcstable#1^#(::(@x, @xs), @l2) -> lcstable#2^#(lcstable(@xs, @l2), @l2, @x) } Weak Trs: { #abs(#0()) -> #0() , #abs(#neg(@x)) -> #pos(@x) , #abs(#pos(@x)) -> #pos(@x) , #abs(#s(@x)) -> #pos(#s(@x)) , #equal(@x, @y) -> #eq(@x, @y) , #eq(#0(), #0()) -> #true() , #eq(#0(), #neg(@y)) -> #false() , #eq(#0(), #pos(@y)) -> #false() , #eq(#0(), #s(@y)) -> #false() , #eq(#neg(@x), #0()) -> #false() , #eq(#neg(@x), #neg(@y)) -> #eq(@x, @y) , #eq(#neg(@x), #pos(@y)) -> #false() , #eq(#pos(@x), #0()) -> #false() , #eq(#pos(@x), #neg(@y)) -> #false() , #eq(#pos(@x), #pos(@y)) -> #eq(@x, @y) , #eq(#s(@x), #0()) -> #false() , #eq(#s(@x), #s(@y)) -> #eq(@x, @y) , #eq(::(@x_1, @x_2), ::(@y_1, @y_2)) -> #and(#eq(@x_1, @y_1), #eq(@x_2, @y_2)) , #eq(::(@x_1, @x_2), nil()) -> #false() , #eq(nil(), ::(@y_1, @y_2)) -> #false() , #eq(nil(), nil()) -> #true() , #greater(@x, @y) -> #ckgt(#compare(@x, @y)) , #compare(#0(), #0()) -> #EQ() , #compare(#0(), #neg(@y)) -> #GT() , #compare(#0(), #pos(@y)) -> #LT() , #compare(#0(), #s(@y)) -> #LT() , #compare(#neg(@x), #0()) -> #LT() , #compare(#neg(@x), #neg(@y)) -> #compare(@y, @x) , #compare(#neg(@x), #pos(@y)) -> #LT() , #compare(#pos(@x), #0()) -> #GT() , #compare(#pos(@x), #neg(@y)) -> #GT() , #compare(#pos(@x), #pos(@y)) -> #compare(@x, @y) , #compare(#s(@x), #0()) -> #GT() , #compare(#s(@x), #s(@y)) -> #compare(@x, @y) , #ckgt(#EQ()) -> #false() , #ckgt(#GT()) -> #true() , #ckgt(#LT()) -> #false() , +(@x, @y) -> #add(@x, @y) , #add(#0(), @y) -> @y , #add(#neg(#s(#0())), @y) -> #pred(@y) , #add(#neg(#s(#s(@x))), @y) -> #pred(#add(#pos(#s(@x)), @y)) , #add(#pos(#s(#0())), @y) -> #succ(@y) , #add(#pos(#s(#s(@x))), @y) -> #succ(#add(#pos(#s(@x)), @y)) , firstline(@l) -> firstline#1(@l) , firstline#1(::(@x, @xs)) -> ::(#abs(#0()), firstline(@xs)) , firstline#1(nil()) -> nil() , lcstable(@l1, @l2) -> lcstable#1(@l1, @l2) , lcstable#1(::(@x, @xs), @l2) -> lcstable#2(lcstable(@xs, @l2), @l2, @x) , lcstable#1(nil(), @l2) -> ::(firstline(@l2), nil()) , lcstable#2(@m, @l2, @x) -> lcstable#3(@m, @l2, @x) , lcstable#3(::(@l, @ls), @l2, @x) -> ::(newline(@x, @l, @l2), ::(@l, @ls)) , lcstable#3(nil(), @l2, @x) -> nil() , newline(@y, @lastline, @l) -> newline#1(@l, @lastline, @y) , max(@a, @b) -> max#1(#greater(@a, @b), @a, @b) , max#1(#false(), @a, @b) -> @b , max#1(#true(), @a, @b) -> @a , newline#1(::(@x, @xs), @lastline, @y) -> newline#2(@lastline, @x, @xs, @y) , newline#1(nil(), @lastline, @y) -> nil() , newline#2(::(@belowVal, @lastline'), @x, @xs, @y) -> newline#3(newline(@y, @lastline', @xs), @belowVal, @lastline', @x, @y) , newline#2(nil(), @x, @xs, @y) -> nil() , newline#3(@nl, @belowVal, @lastline', @x, @y) -> newline#4(right(@nl), @belowVal, @lastline', @nl, @x, @y) , right(@l) -> right#1(@l) , newline#4(@rightVal, @belowVal, @lastline', @nl, @x, @y) -> newline#5(right(@lastline'), @belowVal, @nl, @rightVal, @x, @y) , newline#5(@diagVal, @belowVal, @nl, @rightVal, @x, @y) -> newline#6(newline#7(#equal(@x, @y), @belowVal, @diagVal, @rightVal), @nl) , newline#7(#false(), @belowVal, @diagVal, @rightVal) -> max(@belowVal, @rightVal) , newline#7(#true(), @belowVal, @diagVal, @rightVal) -> +(@diagVal, #pos(#s(#0()))) , newline#6(@elem, @nl) -> ::(@elem, @nl) , right#1(::(@x, @xs)) -> @x , right#1(nil()) -> #abs(#0()) , #pred(#0()) -> #neg(#s(#0())) , #pred(#neg(#s(@x))) -> #neg(#s(#s(@x))) , #pred(#pos(#s(#0()))) -> #0() , #pred(#pos(#s(#s(@x)))) -> #pos(#s(@x)) , #succ(#0()) -> #pos(#s(#0())) , #succ(#neg(#s(#0()))) -> #0() , #succ(#neg(#s(#s(@x)))) -> #neg(#s(@x)) , #succ(#pos(#s(@x))) -> #pos(#s(#s(@x))) , #and(#false(), #false()) -> #false() , #and(#false(), #true()) -> #false() , #and(#true(), #false()) -> #false() , #and(#true(), #true()) -> #true() } Obligation: innermost runtime complexity Answer: YES(O(1),O(n^1)) We use the processor 'matrix interpretation of dimension 1' to orient following rules strictly. DPs: { 2: firstline#1^#(::(@x, @xs)) -> c_2(firstline^#(@xs)) } Trs: { #greater(@x, @y) -> #ckgt(#compare(@x, @y)) , max(@a, @b) -> max#1(#greater(@a, @b), @a, @b) , newline#2(::(@belowVal, @lastline'), @x, @xs, @y) -> newline#3(newline(@y, @lastline', @xs), @belowVal, @lastline', @x, @y) , right#1(::(@x, @xs)) -> @x , right#1(nil()) -> #abs(#0()) } Sub-proof: ---------- The following argument positions are usable: Uargs(c_1) = {1}, Uargs(c_2) = {1}, Uargs(c_6) = {1}, Uargs(c_7) = {1}, Uargs(c_8) = {1}, Uargs(c_9) = {1}, Uargs(c_10) = {1}, Uargs(c_11) = {1} TcT has computed following constructor-based matrix interpretation satisfying not(EDA). [#0] = [0] [#abs](x1) = [0] [#neg](x1) = [0] [#pos](x1) = [0] [#s](x1) = [1] [#equal](x1, x2) = [0] [#eq](x1, x2) = [0] [#greater](x1, x2) = [1] [#compare](x1, x2) = [0] [#ckgt](x1) = [1] x1 + [0] [+](x1, x2) = [0] [#add](x1, x2) = [1] x2 + [0] [firstline](x1) = [0] [firstline#1](x1) = [0] [::](x1, x2) = [1] x1 + [1] x2 + [1] [nil] = [1] [lcstable](x1, x2) = [0] [lcstable#1](x1, x2) = [0] [lcstable#2](x1, x2, x3) = [0] [lcstable#3](x1, x2, x3) = [1] x1 + [0] [newline](x1, x2, x3) = [0] [max](x1, x2) = [1] [max#1](x1, x2, x3) = [0] [#false] = [0] [#true] = [1] [newline#1](x1, x2, x3) = [1] [newline#2](x1, x2, x3, x4) = [1] x1 + [0] [newline#3](x1, x2, x3, x4, x5) = [0] [right](x1) = [0] [newline#4](x1, x2, x3, x4, x5, x6) = [0] [newline#5](x1, x2, x3, x4, x5, x6) = [0] [newline#7](x1, x2, x3, x4) = [0] [newline#6](x1, x2) = [0] [right#1](x1) = [1] x1 + [0] [#pred](x1) = [0] [#succ](x1) = [1] x1 + [0] [#and](x1, x2) = [0] [#EQ] = [0] [#GT] = [0] [#LT] = [0] [#abs^#](x1) = [0] [#equal^#](x1, x2) = [0] [#eq^#](x1, x2) = [0] [#greater^#](x1, x2) = [0] [#ckgt^#](x1) = [0] [#compare^#](x1, x2) = [0] [+^#](x1, x2) = [0] [#add^#](x1, x2) = [0] [firstline^#](x1) = [1] x1 + [1] [firstline#1^#](x1) = [1] x1 + [1] [lcs^#](x1, x2) = [0] [lcs#1^#](x1) = [0] [lcstable^#](x1, x2) = [1] x2 + [1] [lcstable#1^#](x1, x2) = [1] x2 + [1] [lcs#2^#](x1) = [0] [lcs#3^#](x1) = [0] [lcstable#2^#](x1, x2, x3) = [1] [lcstable#3^#](x1, x2, x3) = [1] [newline^#](x1, x2, x3) = [1] [newline#1^#](x1, x2, x3) = [1] [max^#](x1, x2) = [0] [max#1^#](x1, x2, x3) = [0] [newline#2^#](x1, x2, x3, x4) = [1] [newline#3^#](x1, x2, x3, x4, x5) = [0] [newline#4^#](x1, x2, x3, x4, x5, x6) = [0] [right^#](x1) = [0] [right#1^#](x1) = [0] [newline#5^#](x1, x2, x3, x4, x5, x6) = [0] [newline#6^#](x1, x2) = [0] [newline#7^#](x1, x2, x3, x4) = [0] [#and^#](x1, x2) = [0] [#pred^#](x1) = [0] [#succ^#](x1) = [0] [c_1](x1) = [1] x1 + [0] [c_2](x1) = [1] x1 + [0] [c_6](x1) = [1] x1 + [0] [c_7](x1) = [1] x1 + [0] [c_8](x1) = [1] x1 + [0] [c_9](x1) = [1] x1 + [0] [c_10](x1) = [1] x1 + [0] [c_11](x1) = [1] x1 + [0] This order satisfies following ordering constraints [firstline^#(@l)] = [1] @l + [1] >= [1] @l + [1] = [c_1(firstline#1^#(@l))] [firstline#1^#(::(@x, @xs))] = [1] @x + [1] @xs + [2] > [1] @xs + [1] = [c_2(firstline^#(@xs))] [lcstable^#(@l1, @l2)] = [1] @l2 + [1] >= [1] @l2 + [1] = [lcstable#1^#(@l1, @l2)] [lcstable#1^#(::(@x, @xs), @l2)] = [1] @l2 + [1] >= [1] @l2 + [1] = [lcstable^#(@xs, @l2)] [lcstable#1^#(::(@x, @xs), @l2)] = [1] @l2 + [1] >= [1] = [lcstable#2^#(lcstable(@xs, @l2), @l2, @x)] [lcstable#1^#(nil(), @l2)] = [1] @l2 + [1] >= [1] @l2 + [1] = [c_6(firstline^#(@l2))] [lcstable#2^#(@m, @l2, @x)] = [1] >= [1] = [c_7(lcstable#3^#(@m, @l2, @x))] [lcstable#3^#(::(@l, @ls), @l2, @x)] = [1] >= [1] = [c_8(newline^#(@x, @l, @l2))] [newline^#(@y, @lastline, @l)] = [1] >= [1] = [c_9(newline#1^#(@l, @lastline, @y))] [newline#1^#(::(@x, @xs), @lastline, @y)] = [1] >= [1] = [c_10(newline#2^#(@lastline, @x, @xs, @y))] [newline#2^#(::(@belowVal, @lastline'), @x, @xs, @y)] = [1] >= [1] = [c_11(newline^#(@y, @lastline', @xs))] The strictly oriented rules are moved into the corresponding weak component(s). We are left with following problem, upon which TcT provides the certificate YES(O(1),O(n^1)). Strict DPs: { firstline^#(@l) -> c_1(firstline#1^#(@l)) , lcstable#1^#(nil(), @l2) -> c_6(firstline^#(@l2)) , lcstable#2^#(@m, @l2, @x) -> c_7(lcstable#3^#(@m, @l2, @x)) , lcstable#3^#(::(@l, @ls), @l2, @x) -> c_8(newline^#(@x, @l, @l2)) , newline^#(@y, @lastline, @l) -> c_9(newline#1^#(@l, @lastline, @y)) , newline#1^#(::(@x, @xs), @lastline, @y) -> c_10(newline#2^#(@lastline, @x, @xs, @y)) , newline#2^#(::(@belowVal, @lastline'), @x, @xs, @y) -> c_11(newline^#(@y, @lastline', @xs)) } Weak DPs: { firstline#1^#(::(@x, @xs)) -> c_2(firstline^#(@xs)) , lcstable^#(@l1, @l2) -> lcstable#1^#(@l1, @l2) , lcstable#1^#(::(@x, @xs), @l2) -> lcstable^#(@xs, @l2) , lcstable#1^#(::(@x, @xs), @l2) -> lcstable#2^#(lcstable(@xs, @l2), @l2, @x) } Weak Trs: { #abs(#0()) -> #0() , #abs(#neg(@x)) -> #pos(@x) , #abs(#pos(@x)) -> #pos(@x) , #abs(#s(@x)) -> #pos(#s(@x)) , #equal(@x, @y) -> #eq(@x, @y) , #eq(#0(), #0()) -> #true() , #eq(#0(), #neg(@y)) -> #false() , #eq(#0(), #pos(@y)) -> #false() , #eq(#0(), #s(@y)) -> #false() , #eq(#neg(@x), #0()) -> #false() , #eq(#neg(@x), #neg(@y)) -> #eq(@x, @y) , #eq(#neg(@x), #pos(@y)) -> #false() , #eq(#pos(@x), #0()) -> #false() , #eq(#pos(@x), #neg(@y)) -> #false() , #eq(#pos(@x), #pos(@y)) -> #eq(@x, @y) , #eq(#s(@x), #0()) -> #false() , #eq(#s(@x), #s(@y)) -> #eq(@x, @y) , #eq(::(@x_1, @x_2), ::(@y_1, @y_2)) -> #and(#eq(@x_1, @y_1), #eq(@x_2, @y_2)) , #eq(::(@x_1, @x_2), nil()) -> #false() , #eq(nil(), ::(@y_1, @y_2)) -> #false() , #eq(nil(), nil()) -> #true() , #greater(@x, @y) -> #ckgt(#compare(@x, @y)) , #compare(#0(), #0()) -> #EQ() , #compare(#0(), #neg(@y)) -> #GT() , #compare(#0(), #pos(@y)) -> #LT() , #compare(#0(), #s(@y)) -> #LT() , #compare(#neg(@x), #0()) -> #LT() , #compare(#neg(@x), #neg(@y)) -> #compare(@y, @x) , #compare(#neg(@x), #pos(@y)) -> #LT() , #compare(#pos(@x), #0()) -> #GT() , #compare(#pos(@x), #neg(@y)) -> #GT() , #compare(#pos(@x), #pos(@y)) -> #compare(@x, @y) , #compare(#s(@x), #0()) -> #GT() , #compare(#s(@x), #s(@y)) -> #compare(@x, @y) , #ckgt(#EQ()) -> #false() , #ckgt(#GT()) -> #true() , #ckgt(#LT()) -> #false() , +(@x, @y) -> #add(@x, @y) , #add(#0(), @y) -> @y , #add(#neg(#s(#0())), @y) -> #pred(@y) , #add(#neg(#s(#s(@x))), @y) -> #pred(#add(#pos(#s(@x)), @y)) , #add(#pos(#s(#0())), @y) -> #succ(@y) , #add(#pos(#s(#s(@x))), @y) -> #succ(#add(#pos(#s(@x)), @y)) , firstline(@l) -> firstline#1(@l) , firstline#1(::(@x, @xs)) -> ::(#abs(#0()), firstline(@xs)) , firstline#1(nil()) -> nil() , lcstable(@l1, @l2) -> lcstable#1(@l1, @l2) , lcstable#1(::(@x, @xs), @l2) -> lcstable#2(lcstable(@xs, @l2), @l2, @x) , lcstable#1(nil(), @l2) -> ::(firstline(@l2), nil()) , lcstable#2(@m, @l2, @x) -> lcstable#3(@m, @l2, @x) , lcstable#3(::(@l, @ls), @l2, @x) -> ::(newline(@x, @l, @l2), ::(@l, @ls)) , lcstable#3(nil(), @l2, @x) -> nil() , newline(@y, @lastline, @l) -> newline#1(@l, @lastline, @y) , max(@a, @b) -> max#1(#greater(@a, @b), @a, @b) , max#1(#false(), @a, @b) -> @b , max#1(#true(), @a, @b) -> @a , newline#1(::(@x, @xs), @lastline, @y) -> newline#2(@lastline, @x, @xs, @y) , newline#1(nil(), @lastline, @y) -> nil() , newline#2(::(@belowVal, @lastline'), @x, @xs, @y) -> newline#3(newline(@y, @lastline', @xs), @belowVal, @lastline', @x, @y) , newline#2(nil(), @x, @xs, @y) -> nil() , newline#3(@nl, @belowVal, @lastline', @x, @y) -> newline#4(right(@nl), @belowVal, @lastline', @nl, @x, @y) , right(@l) -> right#1(@l) , newline#4(@rightVal, @belowVal, @lastline', @nl, @x, @y) -> newline#5(right(@lastline'), @belowVal, @nl, @rightVal, @x, @y) , newline#5(@diagVal, @belowVal, @nl, @rightVal, @x, @y) -> newline#6(newline#7(#equal(@x, @y), @belowVal, @diagVal, @rightVal), @nl) , newline#7(#false(), @belowVal, @diagVal, @rightVal) -> max(@belowVal, @rightVal) , newline#7(#true(), @belowVal, @diagVal, @rightVal) -> +(@diagVal, #pos(#s(#0()))) , newline#6(@elem, @nl) -> ::(@elem, @nl) , right#1(::(@x, @xs)) -> @x , right#1(nil()) -> #abs(#0()) , #pred(#0()) -> #neg(#s(#0())) , #pred(#neg(#s(@x))) -> #neg(#s(#s(@x))) , #pred(#pos(#s(#0()))) -> #0() , #pred(#pos(#s(#s(@x)))) -> #pos(#s(@x)) , #succ(#0()) -> #pos(#s(#0())) , #succ(#neg(#s(#0()))) -> #0() , #succ(#neg(#s(#s(@x)))) -> #neg(#s(@x)) , #succ(#pos(#s(@x))) -> #pos(#s(#s(@x))) , #and(#false(), #false()) -> #false() , #and(#false(), #true()) -> #false() , #and(#true(), #false()) -> #false() , #and(#true(), #true()) -> #true() } Obligation: innermost runtime complexity Answer: YES(O(1),O(n^1)) We use the processor 'matrix interpretation of dimension 1' to orient following rules strictly. DPs: { 2: lcstable#1^#(nil(), @l2) -> c_6(firstline^#(@l2)) , 7: newline#2^#(::(@belowVal, @lastline'), @x, @xs, @y) -> c_11(newline^#(@y, @lastline', @xs)) , 8: firstline#1^#(::(@x, @xs)) -> c_2(firstline^#(@xs)) , 11: lcstable#1^#(::(@x, @xs), @l2) -> lcstable#2^#(lcstable(@xs, @l2), @l2, @x) } Trs: { #greater(@x, @y) -> #ckgt(#compare(@x, @y)) , #add(#pos(#s(#0())), @y) -> #succ(@y) , #add(#pos(#s(#s(@x))), @y) -> #succ(#add(#pos(#s(@x)), @y)) , lcstable#1(::(@x, @xs), @l2) -> lcstable#2(lcstable(@xs, @l2), @l2, @x) , max(@a, @b) -> max#1(#greater(@a, @b), @a, @b) , newline#1(nil(), @lastline, @y) -> nil() , newline#2(::(@belowVal, @lastline'), @x, @xs, @y) -> newline#3(newline(@y, @lastline', @xs), @belowVal, @lastline', @x, @y) } Sub-proof: ---------- The following argument positions are usable: Uargs(c_1) = {1}, Uargs(c_2) = {1}, Uargs(c_6) = {1}, Uargs(c_7) = {1}, Uargs(c_8) = {1}, Uargs(c_9) = {1}, Uargs(c_10) = {1}, Uargs(c_11) = {1} TcT has computed following constructor-based matrix interpretation satisfying not(EDA). [#0] = [0] [#abs](x1) = [0] [#neg](x1) = [0] [#pos](x1) = [1] [#s](x1) = [0] [#equal](x1, x2) = [0] [#eq](x1, x2) = [0] [#greater](x1, x2) = [1] [#compare](x1, x2) = [0] [#ckgt](x1) = [1] x1 + [0] [+](x1, x2) = [0] [#add](x1, x2) = [1] x1 + [1] x2 + [0] [firstline](x1) = [0] [firstline#1](x1) = [0] [::](x1, x2) = [1] x2 + [1] [nil] = [0] [lcstable](x1, x2) = [0] [lcstable#1](x1, x2) = [1] x2 + [1] [lcstable#2](x1, x2, x3) = [0] [lcstable#3](x1, x2, x3) = [1] x1 + [0] [newline](x1, x2, x3) = [0] [max](x1, x2) = [1] [max#1](x1, x2, x3) = [0] [#false] = [0] [#true] = [1] [newline#1](x1, x2, x3) = [1] [newline#2](x1, x2, x3, x4) = [1] x1 + [0] [newline#3](x1, x2, x3, x4, x5) = [0] [right](x1) = [0] [newline#4](x1, x2, x3, x4, x5, x6) = [0] [newline#5](x1, x2, x3, x4, x5, x6) = [0] [newline#7](x1, x2, x3, x4) = [0] [newline#6](x1, x2) = [0] [right#1](x1) = [1] x1 + [0] [#pred](x1) = [0] [#succ](x1) = [0] [#and](x1, x2) = [0] [#EQ] = [0] [#GT] = [1] [#LT] = [0] [#abs^#](x1) = [0] [#equal^#](x1, x2) = [0] [#eq^#](x1, x2) = [0] [#greater^#](x1, x2) = [0] [#ckgt^#](x1) = [0] [#compare^#](x1, x2) = [0] [+^#](x1, x2) = [0] [#add^#](x1, x2) = [0] [firstline^#](x1) = [1] x1 + [0] [firstline#1^#](x1) = [1] x1 + [0] [lcs^#](x1, x2) = [0] [lcs#1^#](x1) = [0] [lcstable^#](x1, x2) = [1] x2 + [1] [lcstable#1^#](x1, x2) = [1] x2 + [1] [lcs#2^#](x1) = [0] [lcs#3^#](x1) = [0] [lcstable#2^#](x1, x2, x3) = [1] x2 + [0] [lcstable#3^#](x1, x2, x3) = [1] x2 + [0] [newline^#](x1, x2, x3) = [1] x3 + [0] [newline#1^#](x1, x2, x3) = [1] x1 + [0] [max^#](x1, x2) = [0] [max#1^#](x1, x2, x3) = [0] [newline#2^#](x1, x2, x3, x4) = [1] x3 + [1] [newline#3^#](x1, x2, x3, x4, x5) = [0] [newline#4^#](x1, x2, x3, x4, x5, x6) = [0] [right^#](x1) = [0] [right#1^#](x1) = [0] [newline#5^#](x1, x2, x3, x4, x5, x6) = [0] [newline#6^#](x1, x2) = [0] [newline#7^#](x1, x2, x3, x4) = [0] [#and^#](x1, x2) = [0] [#pred^#](x1) = [0] [#succ^#](x1) = [0] [c_1](x1) = [1] x1 + [0] [c_2](x1) = [1] x1 + [0] [c_6](x1) = [1] x1 + [0] [c_7](x1) = [1] x1 + [0] [c_8](x1) = [1] x1 + [0] [c_9](x1) = [1] x1 + [0] [c_10](x1) = [1] x1 + [0] [c_11](x1) = [1] x1 + [0] This order satisfies following ordering constraints [firstline^#(@l)] = [1] @l + [0] >= [1] @l + [0] = [c_1(firstline#1^#(@l))] [firstline#1^#(::(@x, @xs))] = [1] @xs + [1] > [1] @xs + [0] = [c_2(firstline^#(@xs))] [lcstable^#(@l1, @l2)] = [1] @l2 + [1] >= [1] @l2 + [1] = [lcstable#1^#(@l1, @l2)] [lcstable#1^#(::(@x, @xs), @l2)] = [1] @l2 + [1] >= [1] @l2 + [1] = [lcstable^#(@xs, @l2)] [lcstable#1^#(::(@x, @xs), @l2)] = [1] @l2 + [1] > [1] @l2 + [0] = [lcstable#2^#(lcstable(@xs, @l2), @l2, @x)] [lcstable#1^#(nil(), @l2)] = [1] @l2 + [1] > [1] @l2 + [0] = [c_6(firstline^#(@l2))] [lcstable#2^#(@m, @l2, @x)] = [1] @l2 + [0] >= [1] @l2 + [0] = [c_7(lcstable#3^#(@m, @l2, @x))] [lcstable#3^#(::(@l, @ls), @l2, @x)] = [1] @l2 + [0] >= [1] @l2 + [0] = [c_8(newline^#(@x, @l, @l2))] [newline^#(@y, @lastline, @l)] = [1] @l + [0] >= [1] @l + [0] = [c_9(newline#1^#(@l, @lastline, @y))] [newline#1^#(::(@x, @xs), @lastline, @y)] = [1] @xs + [1] >= [1] @xs + [1] = [c_10(newline#2^#(@lastline, @x, @xs, @y))] [newline#2^#(::(@belowVal, @lastline'), @x, @xs, @y)] = [1] @xs + [1] > [1] @xs + [0] = [c_11(newline^#(@y, @lastline', @xs))] Consider the set of all dependency pairs DPs: { 1: firstline^#(@l) -> c_1(firstline#1^#(@l)) , 2: lcstable#1^#(nil(), @l2) -> c_6(firstline^#(@l2)) , 3: lcstable#2^#(@m, @l2, @x) -> c_7(lcstable#3^#(@m, @l2, @x)) , 4: lcstable#3^#(::(@l, @ls), @l2, @x) -> c_8(newline^#(@x, @l, @l2)) , 5: newline^#(@y, @lastline, @l) -> c_9(newline#1^#(@l, @lastline, @y)) , 6: newline#1^#(::(@x, @xs), @lastline, @y) -> c_10(newline#2^#(@lastline, @x, @xs, @y)) , 7: newline#2^#(::(@belowVal, @lastline'), @x, @xs, @y) -> c_11(newline^#(@y, @lastline', @xs)) , 8: firstline#1^#(::(@x, @xs)) -> c_2(firstline^#(@xs)) , 9: lcstable^#(@l1, @l2) -> lcstable#1^#(@l1, @l2) , 10: lcstable#1^#(::(@x, @xs), @l2) -> lcstable^#(@xs, @l2) , 11: lcstable#1^#(::(@x, @xs), @l2) -> lcstable#2^#(lcstable(@xs, @l2), @l2, @x) } Processor 'matrix interpretation of dimension 1' induces the complexity certificate YES(?,O(n^1)) on application of dependency pairs {2,7,8,11}. These cover all (indirect) predecessors of dependency pairs {1,2,3,4,5,6,7,8,11}, their number of application is equally bounded. The dependency pairs are shifted into the corresponding weak component(s). We apply the transformation 'removetails' on the sub-problem: Weak DPs: { firstline^#(@l) -> c_1(firstline#1^#(@l)) , firstline#1^#(::(@x, @xs)) -> c_2(firstline^#(@xs)) , lcstable^#(@l1, @l2) -> lcstable#1^#(@l1, @l2) , lcstable#1^#(::(@x, @xs), @l2) -> lcstable^#(@xs, @l2) , lcstable#1^#(::(@x, @xs), @l2) -> lcstable#2^#(lcstable(@xs, @l2), @l2, @x) , lcstable#1^#(nil(), @l2) -> c_6(firstline^#(@l2)) , lcstable#2^#(@m, @l2, @x) -> c_7(lcstable#3^#(@m, @l2, @x)) , lcstable#3^#(::(@l, @ls), @l2, @x) -> c_8(newline^#(@x, @l, @l2)) , newline^#(@y, @lastline, @l) -> c_9(newline#1^#(@l, @lastline, @y)) , newline#1^#(::(@x, @xs), @lastline, @y) -> c_10(newline#2^#(@lastline, @x, @xs, @y)) , newline#2^#(::(@belowVal, @lastline'), @x, @xs, @y) -> c_11(newline^#(@y, @lastline', @xs)) } Weak Trs: { #abs(#0()) -> #0() , #abs(#neg(@x)) -> #pos(@x) , #abs(#pos(@x)) -> #pos(@x) , #abs(#s(@x)) -> #pos(#s(@x)) , #equal(@x, @y) -> #eq(@x, @y) , #eq(#0(), #0()) -> #true() , #eq(#0(), #neg(@y)) -> #false() , #eq(#0(), #pos(@y)) -> #false() , #eq(#0(), #s(@y)) -> #false() , #eq(#neg(@x), #0()) -> #false() , #eq(#neg(@x), #neg(@y)) -> #eq(@x, @y) , #eq(#neg(@x), #pos(@y)) -> #false() , #eq(#pos(@x), #0()) -> #false() , #eq(#pos(@x), #neg(@y)) -> #false() , #eq(#pos(@x), #pos(@y)) -> #eq(@x, @y) , #eq(#s(@x), #0()) -> #false() , #eq(#s(@x), #s(@y)) -> #eq(@x, @y) , #eq(::(@x_1, @x_2), ::(@y_1, @y_2)) -> #and(#eq(@x_1, @y_1), #eq(@x_2, @y_2)) , #eq(::(@x_1, @x_2), nil()) -> #false() , #eq(nil(), ::(@y_1, @y_2)) -> #false() , #eq(nil(), nil()) -> #true() , #greater(@x, @y) -> #ckgt(#compare(@x, @y)) , #compare(#0(), #0()) -> #EQ() , #compare(#0(), #neg(@y)) -> #GT() , #compare(#0(), #pos(@y)) -> #LT() , #compare(#0(), #s(@y)) -> #LT() , #compare(#neg(@x), #0()) -> #LT() , #compare(#neg(@x), #neg(@y)) -> #compare(@y, @x) , #compare(#neg(@x), #pos(@y)) -> #LT() , #compare(#pos(@x), #0()) -> #GT() , #compare(#pos(@x), #neg(@y)) -> #GT() , #compare(#pos(@x), #pos(@y)) -> #compare(@x, @y) , #compare(#s(@x), #0()) -> #GT() , #compare(#s(@x), #s(@y)) -> #compare(@x, @y) , #ckgt(#EQ()) -> #false() , #ckgt(#GT()) -> #true() , #ckgt(#LT()) -> #false() , +(@x, @y) -> #add(@x, @y) , #add(#0(), @y) -> @y , #add(#neg(#s(#0())), @y) -> #pred(@y) , #add(#neg(#s(#s(@x))), @y) -> #pred(#add(#pos(#s(@x)), @y)) , #add(#pos(#s(#0())), @y) -> #succ(@y) , #add(#pos(#s(#s(@x))), @y) -> #succ(#add(#pos(#s(@x)), @y)) , firstline(@l) -> firstline#1(@l) , firstline#1(::(@x, @xs)) -> ::(#abs(#0()), firstline(@xs)) , firstline#1(nil()) -> nil() , lcstable(@l1, @l2) -> lcstable#1(@l1, @l2) , lcstable#1(::(@x, @xs), @l2) -> lcstable#2(lcstable(@xs, @l2), @l2, @x) , lcstable#1(nil(), @l2) -> ::(firstline(@l2), nil()) , lcstable#2(@m, @l2, @x) -> lcstable#3(@m, @l2, @x) , lcstable#3(::(@l, @ls), @l2, @x) -> ::(newline(@x, @l, @l2), ::(@l, @ls)) , lcstable#3(nil(), @l2, @x) -> nil() , newline(@y, @lastline, @l) -> newline#1(@l, @lastline, @y) , max(@a, @b) -> max#1(#greater(@a, @b), @a, @b) , max#1(#false(), @a, @b) -> @b , max#1(#true(), @a, @b) -> @a , newline#1(::(@x, @xs), @lastline, @y) -> newline#2(@lastline, @x, @xs, @y) , newline#1(nil(), @lastline, @y) -> nil() , newline#2(::(@belowVal, @lastline'), @x, @xs, @y) -> newline#3(newline(@y, @lastline', @xs), @belowVal, @lastline', @x, @y) , newline#2(nil(), @x, @xs, @y) -> nil() , newline#3(@nl, @belowVal, @lastline', @x, @y) -> newline#4(right(@nl), @belowVal, @lastline', @nl, @x, @y) , right(@l) -> right#1(@l) , newline#4(@rightVal, @belowVal, @lastline', @nl, @x, @y) -> newline#5(right(@lastline'), @belowVal, @nl, @rightVal, @x, @y) , newline#5(@diagVal, @belowVal, @nl, @rightVal, @x, @y) -> newline#6(newline#7(#equal(@x, @y), @belowVal, @diagVal, @rightVal), @nl) , newline#7(#false(), @belowVal, @diagVal, @rightVal) -> max(@belowVal, @rightVal) , newline#7(#true(), @belowVal, @diagVal, @rightVal) -> +(@diagVal, #pos(#s(#0()))) , newline#6(@elem, @nl) -> ::(@elem, @nl) , right#1(::(@x, @xs)) -> @x , right#1(nil()) -> #abs(#0()) , #pred(#0()) -> #neg(#s(#0())) , #pred(#neg(#s(@x))) -> #neg(#s(#s(@x))) , #pred(#pos(#s(#0()))) -> #0() , #pred(#pos(#s(#s(@x)))) -> #pos(#s(@x)) , #succ(#0()) -> #pos(#s(#0())) , #succ(#neg(#s(#0()))) -> #0() , #succ(#neg(#s(#s(@x)))) -> #neg(#s(@x)) , #succ(#pos(#s(@x))) -> #pos(#s(#s(@x))) , #and(#false(), #false()) -> #false() , #and(#false(), #true()) -> #false() , #and(#true(), #false()) -> #false() , #and(#true(), #true()) -> #true() } StartTerms: basic terms Strategy: innermost The following weak DPs constitute a sub-graph of the DG that is closed under successors. The DPs are removed. { firstline^#(@l) -> c_1(firstline#1^#(@l)) , firstline#1^#(::(@x, @xs)) -> c_2(firstline^#(@xs)) , lcstable^#(@l1, @l2) -> lcstable#1^#(@l1, @l2) , lcstable#1^#(::(@x, @xs), @l2) -> lcstable^#(@xs, @l2) , lcstable#1^#(::(@x, @xs), @l2) -> lcstable#2^#(lcstable(@xs, @l2), @l2, @x) , lcstable#1^#(nil(), @l2) -> c_6(firstline^#(@l2)) , lcstable#2^#(@m, @l2, @x) -> c_7(lcstable#3^#(@m, @l2, @x)) , lcstable#3^#(::(@l, @ls), @l2, @x) -> c_8(newline^#(@x, @l, @l2)) , newline^#(@y, @lastline, @l) -> c_9(newline#1^#(@l, @lastline, @y)) , newline#1^#(::(@x, @xs), @lastline, @y) -> c_10(newline#2^#(@lastline, @x, @xs, @y)) , newline#2^#(::(@belowVal, @lastline'), @x, @xs, @y) -> c_11(newline^#(@y, @lastline', @xs)) } We apply the transformation 'usablerules' on the sub-problem: Weak Trs: { #abs(#0()) -> #0() , #abs(#neg(@x)) -> #pos(@x) , #abs(#pos(@x)) -> #pos(@x) , #abs(#s(@x)) -> #pos(#s(@x)) , #equal(@x, @y) -> #eq(@x, @y) , #eq(#0(), #0()) -> #true() , #eq(#0(), #neg(@y)) -> #false() , #eq(#0(), #pos(@y)) -> #false() , #eq(#0(), #s(@y)) -> #false() , #eq(#neg(@x), #0()) -> #false() , #eq(#neg(@x), #neg(@y)) -> #eq(@x, @y) , #eq(#neg(@x), #pos(@y)) -> #false() , #eq(#pos(@x), #0()) -> #false() , #eq(#pos(@x), #neg(@y)) -> #false() , #eq(#pos(@x), #pos(@y)) -> #eq(@x, @y) , #eq(#s(@x), #0()) -> #false() , #eq(#s(@x), #s(@y)) -> #eq(@x, @y) , #eq(::(@x_1, @x_2), ::(@y_1, @y_2)) -> #and(#eq(@x_1, @y_1), #eq(@x_2, @y_2)) , #eq(::(@x_1, @x_2), nil()) -> #false() , #eq(nil(), ::(@y_1, @y_2)) -> #false() , #eq(nil(), nil()) -> #true() , #greater(@x, @y) -> #ckgt(#compare(@x, @y)) , #compare(#0(), #0()) -> #EQ() , #compare(#0(), #neg(@y)) -> #GT() , #compare(#0(), #pos(@y)) -> #LT() , #compare(#0(), #s(@y)) -> #LT() , #compare(#neg(@x), #0()) -> #LT() , #compare(#neg(@x), #neg(@y)) -> #compare(@y, @x) , #compare(#neg(@x), #pos(@y)) -> #LT() , #compare(#pos(@x), #0()) -> #GT() , #compare(#pos(@x), #neg(@y)) -> #GT() , #compare(#pos(@x), #pos(@y)) -> #compare(@x, @y) , #compare(#s(@x), #0()) -> #GT() , #compare(#s(@x), #s(@y)) -> #compare(@x, @y) , #ckgt(#EQ()) -> #false() , #ckgt(#GT()) -> #true() , #ckgt(#LT()) -> #false() , +(@x, @y) -> #add(@x, @y) , #add(#0(), @y) -> @y , #add(#neg(#s(#0())), @y) -> #pred(@y) , #add(#neg(#s(#s(@x))), @y) -> #pred(#add(#pos(#s(@x)), @y)) , #add(#pos(#s(#0())), @y) -> #succ(@y) , #add(#pos(#s(#s(@x))), @y) -> #succ(#add(#pos(#s(@x)), @y)) , firstline(@l) -> firstline#1(@l) , firstline#1(::(@x, @xs)) -> ::(#abs(#0()), firstline(@xs)) , firstline#1(nil()) -> nil() , lcstable(@l1, @l2) -> lcstable#1(@l1, @l2) , lcstable#1(::(@x, @xs), @l2) -> lcstable#2(lcstable(@xs, @l2), @l2, @x) , lcstable#1(nil(), @l2) -> ::(firstline(@l2), nil()) , lcstable#2(@m, @l2, @x) -> lcstable#3(@m, @l2, @x) , lcstable#3(::(@l, @ls), @l2, @x) -> ::(newline(@x, @l, @l2), ::(@l, @ls)) , lcstable#3(nil(), @l2, @x) -> nil() , newline(@y, @lastline, @l) -> newline#1(@l, @lastline, @y) , max(@a, @b) -> max#1(#greater(@a, @b), @a, @b) , max#1(#false(), @a, @b) -> @b , max#1(#true(), @a, @b) -> @a , newline#1(::(@x, @xs), @lastline, @y) -> newline#2(@lastline, @x, @xs, @y) , newline#1(nil(), @lastline, @y) -> nil() , newline#2(::(@belowVal, @lastline'), @x, @xs, @y) -> newline#3(newline(@y, @lastline', @xs), @belowVal, @lastline', @x, @y) , newline#2(nil(), @x, @xs, @y) -> nil() , newline#3(@nl, @belowVal, @lastline', @x, @y) -> newline#4(right(@nl), @belowVal, @lastline', @nl, @x, @y) , right(@l) -> right#1(@l) , newline#4(@rightVal, @belowVal, @lastline', @nl, @x, @y) -> newline#5(right(@lastline'), @belowVal, @nl, @rightVal, @x, @y) , newline#5(@diagVal, @belowVal, @nl, @rightVal, @x, @y) -> newline#6(newline#7(#equal(@x, @y), @belowVal, @diagVal, @rightVal), @nl) , newline#7(#false(), @belowVal, @diagVal, @rightVal) -> max(@belowVal, @rightVal) , newline#7(#true(), @belowVal, @diagVal, @rightVal) -> +(@diagVal, #pos(#s(#0()))) , newline#6(@elem, @nl) -> ::(@elem, @nl) , right#1(::(@x, @xs)) -> @x , right#1(nil()) -> #abs(#0()) , #pred(#0()) -> #neg(#s(#0())) , #pred(#neg(#s(@x))) -> #neg(#s(#s(@x))) , #pred(#pos(#s(#0()))) -> #0() , #pred(#pos(#s(#s(@x)))) -> #pos(#s(@x)) , #succ(#0()) -> #pos(#s(#0())) , #succ(#neg(#s(#0()))) -> #0() , #succ(#neg(#s(#s(@x)))) -> #neg(#s(@x)) , #succ(#pos(#s(@x))) -> #pos(#s(#s(@x))) , #and(#false(), #false()) -> #false() , #and(#false(), #true()) -> #false() , #and(#true(), #false()) -> #false() , #and(#true(), #true()) -> #true() } StartTerms: basic terms Strategy: innermost No rule is usable, rules are removed from the input problem. We are left with following problem, upon which TcT provides the certificate YES(O(1),O(1)). Rules: Empty Obligation: innermost runtime complexity Answer: YES(O(1),O(1)) Empty rules are trivially bounded Wall-time: 0.109137s CPU-time: 0.784s Wall-time: 2.9685s CPU-time: 21.298s Hurray, we answered YES(O(1),O(n^2))